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

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

Are you compiling your program for UNICODE ?

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

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.

> MessageBox(NULL, (LPCTSTR)"Test1", (LPCTSTR)"Test1", MB_OK);
Indiscriminate casting to get the compiler to STFU is a common problem.

Just because you muffled the compiler doesn't make your code good.

Take out the casts, then pay really close attention to the error messages.
http://msdn.microsoft.com/en-us/libr...8VS.71%29.aspx

lawl.

Thanks dragon

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).

commented: thnx :) +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.