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

#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 *型
1
2
3
4
5
6
7
8
9
10
11
12
#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 *型windows

 

不然出现“WinMain没法重载函数”或_tWinMain没法重载函数“”函数

相关文章
相关标签/搜索