Note: Overcoming WinMain’s ANSI lpCmdLine

هذه المقالة متوفرة أيضا باللغة العربية، اقرأها هنا.

I got a question about WinMain and its ANSI lpCmdLine. Are you required to use the ANSI argument? No, you are not!

For unknown reason, WinMain and also main functions come with only ANSI command-line arguments (lpCmdLine in WinMain and argv in main.) To overcome this situation, you can forget about function arguments and use the function GetCommandLine to get a pointer to the command-line string for the current process.

The definition for this function is as follows:

LPTSTR GetCommandLine(VOID)

Simple, isn’t it?