title: Getting input from Win32 edit box[C++]
body: <p>Hello all I have been trying to get input from a Win32 text edit box like so:</p>
  
  <pre><code>    char IP_ADDR[200];
      char NICK[200];
      #define Print(msg) print_line(*hwnd, msg)
      #define Println() Print("\r\n")
  
  
          Print("Welcome to Basic Client 0.01 Alpha!");
          Println();
          Print("Please enter your IP address");
          Println();
          for (;; Sleep(500))
          {
              if (IsKeyDown(VK_RETURN))
              {
                  GetDlgItemText(*hwnd, IDC_MAIN_EDIT2, IP_ADDR, sizeof(IP_ADDR));
                  SetDlgItemText(*hwnd, IDC_MAIN_EDIT2, "");
                  break;
              }
          }
          Print("Please enter a nickname");
          Println();
  
          for (;; Sleep(500))
          {
              if (IsKeyDown(VK_RETURN))
              {
                  GetDlgItemText(*hwnd, IDC_MAIN_EDIT2, NICK, sizeof(NICK));
                  SetDlgItemText(*hwnd, IDC_MAIN_EDIT2, "");
                  break;
              }
          }
  </code></pre>
  
  <p>But this does not go into a loop or stop it till the key is pressed it just keeps going If it helps I have the run function which this is code is from in a new thread so that it can do this while managing the window messages here is the code for this:</p>
  
  <pre><code>Client * c = new Client;
  .....
  int Run(HWND *hwnd)
  {
      MSG msg = { 0 };
      while (msg.message != WM_QUIT)
      {
          if (PeekMessage(&amp;msg, 0, 0, 0, PM_REMOVE))
          {
  
              TranslateMessage(&amp;msg);
              DispatchMessage(&amp;msg);
              _beginthreadex(0, 0, ClientThread, (void*)hwnd, 0, 0);
  
          }
  
  
      }
  
      return 1;
  }
  
  unsigned int __stdcall ClientThread(void*data)
  {
  
      HWND *hwnd = (HWND*)data;
  
  
      c-&gt;Run(hwnd);
      return 0;
  }
  </code></pre>
  
  <p>And here is the IsKeyDown function:</p>
  
  <pre><code>bool Client::IsKeyDown(int vk)
  {
      return ((GetAsyncKeyState(vk) &amp; 0x1) != 0)? true:false;
  }
  </code></pre>