Strings Being Displayed as Asian

~ This may or may not be a compiler-specific problem; I think it is though, so can anyone who is familiar with Microsoft Visual C++ Express 2008 help me out?

I'm following this Windows API tutorial from winprog.org, and the first code it asks you to compile as a test is:

1
2
3
4
5
6
7
8
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
    LPSTR lpCmdLine, int nCmdShow)
{
    MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
    return 0;
}


It says that you must set your compiler to compile as C (instead of C++), which I did. When I tried to compile as C++ I got all sorts of errors.

Now when compiled as C, it runs fine. The dialog box shows up, but the strings for the message and caption are shown in weird Asian characters.

What am I doing wrong? Thanks.
Actually I just solved the problem myself. In Visual C++ Express 2008, Under Project Options > Configuration Options > General, I had to select
Use Multi-Byte Character Set
instead of
Use Unicode Character Set
.
yeah - MSVC defaults to unicode.
However, the best practice is to use the _TEXT macro on string literals. So

MessageBox(NULL, _TEXT("Goodbye, cruel world!"), _TEXT("Note"), MB_OK);
Ah, I had tried using _T() but it didn't work. I recall seeing it used in other C++ sources, but I guess that maybe _T() is for C++ and _TEXT() for C?
Topic archived. No new replies allowed.