#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;
}
1 | 当采用_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无法重载函数“”