Click to See Complete Forum and Search --> : access data in dialog from win32 application


asdeshmukh
June 9th, 2005, 05:19 PM
Hi,
This question is related to win32 user interface programming. This question may some too trivial, and hope you excuse me for that. Firstly am a starter with MFC and this is my first attempt at win32 programming.
I need to use Single threaded runtime library and cannot use MFC. Thus I am using win32.
I have designed a dialog that should take three float values as input. How do write the code to do data exchange so that values entered by the user are available to me in some local variable after the user has clicked "OK" on the dialog after entering some values. I can do this in MFC and but do not know how to do this using win32. I could create file open dialog using GetOpenFileName but did not find any similar function for writing data exchange code.

Any help would be great as I am stuck and want to get this done asap.

Thanks in advance for your help.

Regards,
Abhijit

Smasher/Devourer
June 9th, 2005, 05:30 PM
Have a look at the function GetDlgItemText() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/getdlgitemtext.asp), which allows you to retrieve the text associated with a dialog box control, such as the value the user has typed into an edit box. There's also GetDlgItemInt() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/getdlgitemint.asp) in the case that you're working with integers, but for floating-point values I think you'll just have to get the edit box contents as text, then use a function like atof() to get its numeric value.

For setting the values of edit controls, there are functions analogous to those listed above, called SetDlgItemText() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/setdlgitemtext.asp) and SetDlgItemInt() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/setdlgitemint.asp).