When we used the API MessageBox() of win32,we found that it required 4 parameters,this was not like that in MFC can recieve 1 parameter.
So,how can we use it?
Here is the introduction in MSDN for C++ 6.0:
int MessageBox(
HWND hWnd, // handle of owner window
LPCTSTR lpText, // address of text in message box
LPCTSTR lpCaption, // address of title of message box
UINT uType // style of message box
);
Well,we can do this:
MessageBox(NULL,"Hello Win32","Message",MB_OK);//The parameter 1 is NULL means the MessageBox's parent window is desktop.
And,it can be used.
However,if we want to display an integer,how can we do?
Well,we can use the funtion "wsprintf" which is in <windows.h>.
Here is the introduction in MSDN for C++ 6.0:
int wsprintf(
LPTSTR lpOut, // pointer to buffer for output
LPCTSTR lpFmt, // pointer to format-control string
... // optional arguments
);
And,we can do this:
DWORD dwNum=5201314;
char Buffer[100];
wsprintf(Buffer,"%s",dwNum);
MessageBox(NULL,Buffer,"I Love You",MB_OK);
So,above is the problem of win32's MessageBox,if someone has some advice,please comment,thanks a lot!