title: read text from edit control
body: <p>I want to read the text which the user has typed in a Edit control.
  after entering the text and pressing the button, I want to get the text and add it as an item into a comboBox.
  this is what I am doing in <code>WM_COMMAND</code> of the parent dialog:</p>
  
  <pre><code>case WM_COMMAND:
  
      if(HIWORD(wParam) == BN_CLICKED)
      {
          if ((HWND)lParam == Button[0])
          {
  
  
  
                  int len = GetWindowTextLengthW(Button[2]) + 1;
                  GetWindowTextW(Button[2], text, len);
                  SendMessage(Button[1],(UINT) CB_ADDSTRING,(WPARAM) 0,(LPARAM) text);
  
                  }
          }
  
  
      return 0;
  </code></pre>
  
  <p>but things goes wrong, sometime I get <code>NULL</code> in the "text" variable, sometimes just the first character of the string the user has entered and sometime weird ASCII like characters. what am I doing wron? any ideas ?</p>