#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沒法重載函數「」函數