关于c++messageBox函数
intnSelect=::MessageBox(NULL,"Hello,WindowsXP","Greetings",MB_OKCANCEL);我是一个电脑编程初学者,我...
int nSelect = ::MessageBox(NULL, "Hello, Windows XP", "Greetings", MB_OKCANCEL); 我是一个电脑编程初学者,我想问一下messageBox前面的两个冒号是有什么用,为什么可以这么用,还有就是messageBox里面的几个参数,是自己定义的,还是系统自带的,每个又是什么意思啊 ! 请高手们放着耐心回答一下,帮一下忙啊 ! 呵呵 谢谢了
展开
2个回答
展开全部
前面两个冒号是作用域运算符,代表调用的是CWND类的成员函数。
该函数是已经定义好的。如有错误,欢迎指正。
建议你看看孙鑫老师的《深入详解MFC》,很适合初学者。我现在也在学~~
建议你装MSDN。
下面是MCDN对MessageBox函数的定义:
CWnd::MessageBox
int MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );
Return Value
Specifies the outcome of the function. It is 0 if there is not enough memory to create the message box.
Parameters
lpszText
Points to a CString object or null-terminated string containing the message to be displayed.
lpszCaption
Points to a CString object or null-terminated string to be used for the message-box caption. If lpszCaption is NULL, the default caption “Error” is used.
nType
Specifies the contents and behavior of the message box.
Remarks
Creates and displays a window that contains an application-supplied message and caption, plus a combination of the predefined icons and pushbuttons described in the Message-Box Styles list. Use the global function AfxMessageBox instead of this member function to implement a message box in your application.
The following shows the various system icons that can be used in a message box:
MB_ICONHAND, MB_ICONSTOP, and MB_ICONERROR
MB_ICONQUESTION
MB_ICONEXCLAMATION and MB_ICONWARNING
MB_ICONASTERISK and MB_ICONINFORMATION
该函数是已经定义好的。如有错误,欢迎指正。
建议你看看孙鑫老师的《深入详解MFC》,很适合初学者。我现在也在学~~
建议你装MSDN。
下面是MCDN对MessageBox函数的定义:
CWnd::MessageBox
int MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );
Return Value
Specifies the outcome of the function. It is 0 if there is not enough memory to create the message box.
Parameters
lpszText
Points to a CString object or null-terminated string containing the message to be displayed.
lpszCaption
Points to a CString object or null-terminated string to be used for the message-box caption. If lpszCaption is NULL, the default caption “Error” is used.
nType
Specifies the contents and behavior of the message box.
Remarks
Creates and displays a window that contains an application-supplied message and caption, plus a combination of the predefined icons and pushbuttons described in the Message-Box Styles list. Use the global function AfxMessageBox instead of this member function to implement a message box in your application.
The following shows the various system icons that can be used in a message box:
MB_ICONHAND, MB_ICONSTOP, and MB_ICONERROR
MB_ICONQUESTION
MB_ICONEXCLAMATION and MB_ICONWARNING
MB_ICONASTERISK and MB_ICONINFORMATION
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询