Difference between WinMain and wWinMain
c++, unicode, winapi, windows
Solution
On Windows XP, if an application entry is WinMain, does Windows convert the command line from Unicode to Ansi and pass to the application?
Yes.
If the command line parameter must be in Unicode (for example, Unicode file name, conversion will cause some characters missing), does that mean that I must use wWinMain as the entry function?
Yes, you should, if you want to correctly handle Unicode arguments to your program.
The documentation to WinMain() on MSDN also agrees.
You can, however, also use GetCommandLineW to retrieve the command line specifically in Unicode.
Problem
The only difference is that Winmain takes char* for lpCmdLine parameter, while wWinMain takes wchar_t*. On Windows XP, if an application entry is WinMain, does Windows convert the command line from Unicode to Ansi and pass to the application? If the command line parameter must be in Unicode (for example, Unicode file name, conversion will cause some characters missing), does that mean that I must use wWinMain as the entry function?