title: When using DialogBoxIndirect, how do I get text the user entered when the dialog closes?
body: <p>I'm using DialogBoxIndirect() to create a modal dialog in memory.  One of the controls that I'm adding to the dialog has the EDIT class, so users can type in information in the dialog.  When the dialog is closed, how do I figure out what the user typed into the EDIT field?  I don't have an HWND for the EDIT field or the dialog itself, all I have is the id.  The only way I know of is GetWindowText(), but that requires an HWND.</p>
  
  <p>Code snippet:</p>
  
  <pre><code>//-----------------------
  // Define Edit Input
  //-----------------------
  lpw = lpwAlign(lpw);    // Align DLGITEMTEMPLATE on DWORD boundary
  lpdit = (LPDLGITEMTEMPLATE)lpw;
  lpdit-&gt;x = 10; lpdit-&gt;y = 10;
  lpdit-&gt;cx = 150; lpdit-&gt;cy = 25;
  lpdit-&gt;id = ID_TEXT2;       // Text input
  lpdit-&gt;dwExtendedStyle = WS_EX_CLIENTEDGE;
  lpdit-&gt;style = WS_CHILD | WS_VISIBLE;
  lpw = (LPWORD)(lpdit + 1);
  *lpw++ = 0xFFFF;
  *lpw++ = 0x0081;        // Edit class
  lpwsz = (LPWSTR)lpw;
  nchar = MultiByteToWideChar(CP_ACP, 0, lpszMessage, -1, lpwsz, 50);
  lpw += nchar;
  *lpw++ = 0;             // No creation data
  
  //-----------------------
  // Define an OK button.
  //-----------------------
  lpw = lpwAlign(lpw);    // Align DLGITEMTEMPLATE on DWORD boundary
  lpdit = (LPDLGITEMTEMPLATE)lpw;
  lpdit-&gt;x = 10; lpdit-&gt;y = 40;
  lpdit-&gt;cx = 35; lpdit-&gt;cy = 13;
  lpdit-&gt;id = IDOK;       // OK button identifier
  lpdit-&gt;style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON;
  lpw = (LPWORD)(lpdit + 1);
  *lpw++ = 0xFFFF;
  *lpw++ = 0x0080;        // Button class
  lpwsz = (LPWSTR)lpw;
  nchar = MultiByteToWideChar(CP_ACP, 0, "OK", -1, lpwsz, 50);
  lpw += nchar;
  *lpw++ = 0;             // No creation data
  
  GlobalUnlock(hgbl);
  ret = DialogBoxIndirect(hinst, (LPDLGTEMPLATE)hgbl, GetFocus(), (DLGPROC)GenericDlgProc);
  // How do I get the text here, that the user entered into control id ID_TEXT2?
  </code></pre>