   C++ Win32 Window Text
  I have created a window:nWindow = CreateWindow(L"Edit", L"print(\"Hello, World!\")",WS_BORDER | WS_CHILD | WS_VISIBLE | ES_MULTILINE | WS_VSCROLL | WS_HSCROLL, 0, 30, width, height-30, hWnd,NULL, NULL, NULL);When a user clicks a button I want to get all the text that the user has typed into this textbox.  Do you know how?   
TCHAR Buffer[/* insert length of buffer */];int Length = GetWindowText(nWindow, Buffer, sizeof(Buffer)/sizeof(Buffer[0]));[edit]MSDN - GetWindowText FunctionThe code above would need to be handled in the WM_COMMAND message sent by the button press, where nWindow is the handle to your textbox.(also changed WCHAR to TCHAR)   ;  In your WinProc add this code:...case WM_COMMAND:if(static_cast<HWND>(lParam) == hWndButton && LOWORD(wParam) == BN_CLICKED){    TCHAR buf[MAX_INPUT_LENGTH];    GetWindowText(nWindow, buf, sizeof(buf)/sizeof(buf[0]));    // Use the text here..}break;...Edit: Ninja'd :(   ;  That didn't work.  Can someone give me some example code that takes the ALL of the text in the editbox and put it in a file, named "Test.lua".  Everything was working fine until I had to start converting between const char and wchar_t, then its like my brain melted and I am stuck.   ;  I'm having some flashbacks to another thread started by you - C++ ErrorsThe GetWindowText is what you want.  Store the data in a TCHAR array (as shown in both posts above) and use wcstombs or WideCharToMultiByte to convert the returned text to a CHAR array.  To be safe, you'll want the CHAR array to be longer than the TCHAR array, in case you have any UTF-16 characters than need to map to something larger than a single byte.   ;  Thanks, I'm new to Win32 programming, and I am trying to understand it better.   ;  One more thing...  I have this code:wchar_t Buffer[100];HWND nWind = GetSyntaxWindow(); // Returns the TextBoxGetWindowText(nWind, Buffer, sizeof(Buffer)/sizeof(Buffer[0]));std::ofstream File;File.open("Test.lua");File << Buffer;File.close();It should be writing:print("Hello, World!")To the file, but instead, it is writing:0021EFE0That looks like it's memory location so I tried:File << *Buffer;An this is what it wrote to the File:0Do you know how I can make it write:print("Hello, World!")??????;  You need to use a wide character stream (wofstream) for wchar_t strings:#include <iostream>#include <fstream>using namespace std;int main() {const wchar_t wideMessage[] = L"This is a wide message.";const char narrowMessage[] = "This is a narrow message.";ofstream narrowStream( "./narrow.txt" );narrowStream << narrowMessage << endl << wideMessage << endl;wofstream wideStream( "./wide.txt" );wideStream << narrowMessage << endl<< wideMessage << endl;}narrow.txt:This is a narrow message.002FFB34wide.txt:This is a narrow message.This is a wide message.