MessageBox(NULL, (LPCTSTR)"Test1", (LPCTSTR)"Test1", MB_OK);

This code is popping up the window correctly, but it displays all squares. Whats wrong =(

Edited 6 Years Ago by clutchkiller: n/a

Im just using VC++ express 2008. All default settings so I couldnt tell ya

Then that's probably the problem -- turn UNICODE off! To do that go to menu item Project --> Properties (the last item on that menu) --> Configuration Properties --> General. Then on the right side of the screen change Character Set (third from the bottom) to Not Set Also remove those unnecessary typecasts.

Then that's probably the problem -- turn UNICODE off! To do that go to menu item Project --> Properties (the last item on that menu) --> Configuration Properties --> General. Then on the right side of the screen change Character Set (third from the bottom) to Not Set Also remove those unnecessary typecasts.

There's something I don't understand: Why should UNICODE be off? It does contain more characters than ASCII doesn't it? What displays those characters if UNICODE doesn't?

Well it would display a UNICODE string, were a UNICODE string actually passed as a parameter.

> (LPCTSTR)"Test1"
Would be stored in memory as 54 65 73 74 31 00
Now whilst 0x6554 is in the UNICODE space, it isn't going to be anything resembling Latin text.

Now saying L"Test1" would result in 54 00 65 00 73 00 74 00 31 00 00 00
These too are valid UNICODE characters, but 0x0054 is going to display a 'T' for you.

Better still (which seems to have been lost altogether by the OP) would be to say _TEXT("Test1") Then no matter how much you mess with the "turn it on or turn it off options" in the compiler, it will do "the right thing".

Further, if the OP has any ambitions of a career, then knowing about UNICODE is pretty much a given (well knowing more than how to turn it off at any rate).

Comments
thnx :)
This article has been dead for over six months. Start a new discussion instead.