Getting the values of edit boxes
I have an edit box in a dialog box and I want to know how to get the value of the edit box. I have tried this
GetDlgItemText(hDlg, IDEDIT1, szString, MAXLEN);
**NOTE** MAXLEN is defined as 80 and szString is an array of 80 chars
But when I check the string its empty. I know I have typed text in the right edit box, and pressed the right button so those to things can''t be the problem.
Visit http://members.xoom.com/ivanickgames
Visit http://members.xoom.com/ivanickgames
Did you call UpdateData? If you didn''t nothing much''ll be updated.
Are you using the DDX macros?
~ Mad Keith ~
**SoftwareMode**
Are you using the DDX macros?
~ Mad Keith ~
**SoftwareMode**
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
the GetDlgItemText function doesn''t necessarily have anything to do with the DDX macros. (at least not directly) The function exists as both a member function of CWnd in MFC and a windows api function. Since C++ Freak is passing the HWND of the dialog to the function, he''s probably not using MFC.
To the original poster: make sure the dialog box is still open when the function is called. If you aren''t checking the return value of the function, do so. if its zero, use GetLastError to determine why the function is failing. if the function is not failing i''m not sure what is wrong...
keep us updated
*oof*
To the original poster: make sure the dialog box is still open when the function is called. If you aren''t checking the return value of the function, do so. if its zero, use GetLastError to determine why the function is failing. if the function is not failing i''m not sure what is wrong...
keep us updated
*oof*
*oof*
I got it to work. The problem was this line
#define IDEDIT1 989
I changed it to a number that works though and it works perfectly now. Thanks for the help.
Visit http://members.xoom.com/ivanickgames
#define IDEDIT1 989
I changed it to a number that works though and it works perfectly now. Thanks for the help.
Visit http://members.xoom.com/ivanickgames
Visit http://members.xoom.com/ivanickgames
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement