[Win32 API] GetWindowText () Function

Jan 8, 2011 at 6:19am
Is there any way to use something besides TCHAR in this code:

1
2
3
TCHAR tcInput [256];
GetWindowText (GetDlgItem (hWnd, TEXT_INPUT), tcInput, 256);
MessageBox (hWnd, tcInput, "Test message", NULL);


Such as a std::string or a char* ? If so can someone please tell me how, a few examples would be great!

Thanks !
Jan 8, 2011 at 9:57pm
wow, no one? :(
Jan 8, 2011 at 10:49pm
What is the issue here??
Jan 8, 2011 at 10:59pm
These are pretty much the choices:

char
wchar_t
TCHAR

After the character array is copied to a buffer typed according to one of these, you could then assign it to a std::string (or wstring) for further minipulation.
Jan 9, 2011 at 3:56am
ok thanks I will try later and will let you guys know how it went.
Jan 10, 2011 at 3:24pm
If you don't want to use TCHAR then you can just use the A/W versions of each function and then use char (A) and wchar_t (W) accordingly.
Topic archived. No new replies allowed.