Win32 API编程:WinMain无法重载函数或

时间:2021-12-08 05:27:02

#include "windows.h" #include "tchar.h" int APIENTRY _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow ) { MessageBox(NULL, TEXT("Hello,World!"), TEXT("haha"), MB_OK); return 0; }

当采用_tWinMain作为入口函数时,第三个参数类型应定义为LPTSTR,,表示WCHAR *型

#include "windows.h" #include "tchar.h" int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MessageBox(NULL, TEXT("Hello,World!"), TEXT("haha"), MB_OK); return 0; }

 当采用WinMain作为入口函数时,第三个参数类型应定义为LPSTR,表示CHAR *型

否则出现“WinMain无法重载函数”或_tWinMain无法重载函数“”

Win32 API编程:WinMain无法重载函数或_tWinMain无法重载