MessageBox()方法使用

简介:

MessageBox (NULL, TEXT ("Hello World"), TEXT ("Hello2"), MB_OK);

MessageBox函数原型如下:
int MessageBox (HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
第1个参数是顶层窗口的句柄,它是消息窗口的父窗口。目前我们把这个参数置为NULL,因为Hello2还没有任何其它窗口。第2个参数是准备显示在窗口里的文字。注意传入的字符串是用TEXT宏包裹的,确保它能够编译成Unicode版本。第3个参数lpCaption是显示在窗口标题栏的文字。最后一个参数uType是一系列标志位,规定消息框如何显示在屏幕上。标志位规定了消息框中按扭的数量和类型,规定了图标的类型以及消息框窗口的风格设置。

表1-1列出了Windows CE下有效的标志位
表1-1: 默认标志位

 

标志位 按钮或者图标

用于按钮


MB_OK OK
 

MB_OKCANCEL OK and Cancel

MB_RETRYCANCEL Retry and Cancel

MB_YESNO Yes and No

MB_YESNOCANCEL Yes, No, and Cancel

MB_ABORTRETRYIGNORE Abort, Retry, and Ignore

用于图标

MB_ICONEXCLAMATION, MB_ICONWARNING Exclamation point

MB_ICONINFORMATION, MB_ICONASTERISK Lower case i within a circle

MB_ICONQUESTION Question mark

MB_YESNO Yes and No

MB_ICONSTOP, MB_ICONERROR, MB_ICONHAND Stop sign

MB_DEFBUTTON1 First button

MB_DEFBUTTON2 Second button

MB_DEFBUTTON3 Third button

For Window Styles:

MB_SETFOREGROUND Bring the message box to the foreground.
 

MB_TOPMOST Make the message box the topmost window.

MessageBox的返回值指出用户按了哪个按扭。

返回值如下:

IDOK OK button pressed

IDYES Yes button presse

IDNO No button pressed

IDCANCEL Cancel button pressed or Esc key pressed


IDABORT Abort button pressed

IDRETRY Retry button presse

IDIGNORE Ignore button pressed




     本文转自xyz_lmn51CTO博客,原文链接:http://blog.51cto.com/xyzlmn/818949,如需转载请自行联系原作者


相关文章
|
5月前
|
Python
tkinter之messagebox
tkinter之messagebox
18 2
|
Python
Tkinter的Menu与Messagebox
菜单控件Menu与对话框控件Messagebox
72 0
Tkinter的Menu与Messagebox
关于 QMessageBox定制大小重写showEvent失败的 解决方法
关于 QMessageBox定制大小重写showEvent失败的 解决方法
关于 QMessageBox定制大小重写showEvent失败的 解决方法
|
编译器
在类库中使用MessageBox
机房收费系统(VB.Net版)过程中,在D层的SqlHelper类中有一个异常捕获处理,捕获了异常之后想使用MessageBox.Show()弹出异常描述,但在编译时出现了“未声明“MessageBox”。它可能因其保护级别而不可访问。”的错误:
在类库中使用MessageBox
MessageBox.Show()的各种用法
winform MessageBox.Show Api整体说明介绍
195 0
|
C#
MessageBox.show显示窗口在最上层
C#中使用MessageBox.Show();有时候会被主窗口挡住而看不到。使用如下语句则可以使其显示在最上层。 MessageBox.Show("MessageBox显示窗口在最上层了吗?", "系统提示", MessageBoxButtons.
3237 0