Q:

C++ Win32 GDI+ drawstring from wchar_t*

I've done searching and spent at least an hour on this.
wchar_t* fooBar = (wchar_t*)L"BlahBlah\0";
//GetWindowText(pDIS->hwndItem, (wchar_t*)fooBar, 64); 
g->DrawString(fooBar, -1, &font, rectf, &strFormat, textColorUp);

That works, and compiles; as is the string is drawn correctly "BlahBlah."
The problem is that I want to use the value of GetWindowText() that I have commented it out.
It is likely problem converting, but I just can't find it.

A:

You need to allocate space for the GetWindowText function to write to. You can't provide the address of a string literal since those are not modifiable.
wchar_t buffer[1024];
GetWindowText(pDIS->hwndItem, buffer, _countof(buffer));
g->DrawString(fooBar, -1, &font, rectf, &strFormat, textColorUp);

