Visual C++:error C2664: 'GetModuleFileNameW' : cannot convert parameter 2 from 'char' to 'LPWCH'

A lot of the "functions" of the Windows API are actually macroes to either the ANSI (A) or Unicode (W for wide) version of the function. Depending on your project settings, these macroes will be either DoSomeFunctionA or DoSomeFunctionW when you want to callDoSomeFunction. The portable way would be then to useTCHAR because it is defined aschar for ANSI and wchar_t for Unicode.

If you don't want to compile with Unicode, you can change your project settings toProject Properties -> Configuration Properties -> General -> Character Set -> Use Multibyte Character Set.

If you do want to compile with Unicode, then you should append anA (ex:GetModuleFileNameA) to the necessary function names.

你可能感兴趣的:(Visual C++:error C2664: 'GetModuleFileNameW' : cannot convert parameter 2 from 'char' to 'LPWCH')