title: Win32 - Retrieving control of DialogBox using GetDlgItem fails
body: <p>In my main window, after clicking a menu item, a dialog box appears which asks the user for input. That input is then to be retrieved.</p>
  
  <p>Here is the resource file for the dialog box:</p>
  
  <pre><code>//
  // Dialog resources
  //
  IDD_PID DIALOG 0, 0, 158, 84
  STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP
  FONT 8, "MS Sans Serif"
  {
      PUSHBUTTON  "&amp;Ok", ID_PID_RET, 14, 60, 58, 14
      PUSHBUTTON  "&amp;Cancel", ID_PID_CANCEL, 86, 60, 52, 14
      CTEXT       "Enter the PID of the process", -1, 32, 16, 91, 15, SS_CENTER
      CONTROL     "", ID_PID_INPUT, RICHEDIT_CLASS, WS_TABSTOP | WS_BORDER | ES_AUTOHSCROLL, 47, 33, 59, 14, WS_EX_CLIENTEDGE
  }
  </code></pre>
  
  <p>Here is the WindowProc where the dialog is used:</p>
  
  <pre><code>//
  // Message handling for main window
  //
  LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  {
      switch(message)
      {
      case WM_COMMAND:
          switch (LOWORD(wParam))
          {
          case ID_FILE_PID:
              int choice = DialogBox(thishInstance, MAKEINTRESOURCE(IDD_PID), hWnd, AboutDlgProc);
              if (choice == ID_PID_RET)
              {
                  HWND temp = GetDlgItem(hWnd, ID_PID_INPUT);
                  HRESULT HR = GetLastError();
                  SendMessage(temp, WM_GETTEXT, sizeof(buff), (LPARAM)&amp;buff);
  
                  [...]
              }
              break;
          }
      }
  }
  </code></pre>
  
  <p>I am a little uncertain about how it works when I try to get the <code>HWND</code> if I create the windows in the resource files. This should work somehow, right? <code>hWnd</code> is managing the dialog box, and <code>ID_PID_RET</code> is the control ID of the Rich Edit box for user input, so I don't know why <code>GetDlgItem</code> fails. It returns "Control ID not found", but it is defined in my resource.h. Any ideas?</p>