1.error C2660: “CWnd::MessageBoxA” : 函數(shù)不接受 4 個(gè)參數(shù) 錯(cuò)誤解決
1
void CSerialPortEx::ProcessErrorMessage(char *ErrorText)
2
{
3
char *Temp=new char[200];
4
LPVOID lpMsgBuf;
5
FormatMessage(
6
FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
7
NULL,
8
GetLastError(),
9
MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), //Default language
10
(LPTSTR)&lpMsgBuf,
11
0,
12
NULL);
13
sprintf(Temp,
14
"WARNING:%s Failed with the following error:\n%s\nPort:%d\n",
15
(char *)ErrorText,
16
lpMsgBuf,
17
m_nPortNr);
18
MessageBox(NULL,
19
Temp,
20
"Application Error",
21
MB_ICONSTOP);
22
LocalFree(lpMsgBuf);
23
delete[] Temp;
24
}
25

2



3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

四個(gè)參數(shù)的MessageBox()是API中定義的,而在MFC中被重新定義了,是只需要一個(gè)參數(shù)的MessageBox(""); 因此你在MFC中調(diào)用api的函數(shù),要在前面加上::
《待續(xù)》