title: C++ Win32 application continuously crashes when working with static text control. Can't figure out why
body: <pre><code>SendMessage(hEditControl, WM_GETTEXT,255,(LPARAM)editbuffer);
   GetWindowText(hTextControl, (LPWSTR)allText,GetWindowTextLength(hTextControl));
  
  //allText = appendStrings((char*)TEXT("whatever"), (char*)TEXT("whatever"));
  SetWindowText(hTextControl, (LPCWSTR)allText);
  
  //where editbuffer and allText are defined as:
  
      static WCHAR*       editbuffer;
      static WCHAR*       allText;
  </code></pre>
  
  <p>where hEditControl is the handle to an edit control and hTextControl is a handle to a static text control. I want to take the data from the edit control and append it to the static control text. But my program crashes at the getwindowtext function and I can't figure out why. Even without the appendstring function, it still crashes. By the way, this code is in my message processing function for the main window.</p>