Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

Recieving Text Input from a Dialog Box

I am trying to recieve input from a dialog box in C++.  I am able to execute the box, and prompt the user for their name, and they are able to enter text with no problem.  However, I cannot retrieve this text and use it in any way.  I have tried using the procedure GetDlgItemText, with parameters HWindow, ID_NAMEEDIT (The ID control of the name), PlayersName (the string supposedly receiving the input), and MAXNAMELEN (the max length of a name).  I think the HWindow parameter is what is giving me the trouble.  This is supposed to be the handle of the Dialog Box, but this is also the handle of TMyWindow.  What handle should I use, or what else should I try?
Here is a copy of my resource file for the dialog box:
#define ID_NAMEEDIT 113

NAME DIALOG 74,57,176,63
STYLE DS_ABSALIGN | DS_SYSMODAL | DS_LOCALEDIT |      DS_MODALFRAME | DS_NOIDLEMSG | WS_POPUP | WS_VISIBLE |      WS_CAPTION
CAPTION "Welcome"
BEGIN
      CONTROL "&Name", 100, "static", SS_RIGHT | WS_CHILD |                WS_VISIBLE 7,11,29,12
      CONTROL "", ID_NAMEEDIT, "edit", ES_LEFT | WS_BORDER |                WS_TABSTOP | WS_CHILD 44,8,127,15
      CONTROL "&OK", IDOK, "button", BS_DEFPUSHBUTTON |                WS_TABSTOP | WS_CHILD 75,38,24,14
END

Thanks for your help.  If you need any more information about what I'm asking for, please e-mail me at MGarcia@Worldnet.att.net
                                         
0
mgarcia061397
Asked:
mgarcia061397
1 Solution
 
mgarcia061397Author Commented:
Adjusted points to 150
0
 
AVaulinCommented:
Be sure that you try read string before Dialog was closed, ie (as I understood you use BC compiler) read string before calling TDialog::OK method.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now