Application.messagebox

来源:互联网 发布:售电软件市场 编辑:程序博客网 时间:2024/04/27 07:44
Application.MessageBox() 的用法By  zhangjl 发表于 2006-3-4 12:06:37 

Application.MessageBox('已经输入了考生信息,不能重新选择学校。'+#13+'要重新选择学校,必须清除所有考生信息!','警告:',mb_ok+mb_iconAsterisk);

Value   Meaning
==============================================================================================
MB_ABORTRETRYIGNORE The message box contains three push buttons: Abort, Retry, and Ignore.
MB_OK   The message box contains one push button: OK. This is the default.
MB_OKCANCEL  The message box contains two push buttons: OK and Cancel.
MB_RETRYCANCEL  The message box contains two push buttons: Retry and Cancel.
MB_YESNO  The message box contains two push buttons: Yes and No.
MB_YESNOCANCEL  The message box contains three push buttons: Yes, No, and Cancel.

数值   意思
=======================================================
+MB_iconInformation
+MB_iconAsterisk 出现惊叹号(警告)
+MB_IcoStop
+MB_IcoHand  出现X符号
+MB_IcoQuistion  出现问号

MessageBox returns 0 if there isn抰 enough memory to create the message box. Otherwise it returns one of the following values:

Value Numeric value Meaning
====================================
IDOK  1 The user chose the OK button.
IDCANCEL 2 The user chose the Cancel button.
IDABORT  3 The user chose the Abort button.
IDRETRY  4 The user chose the Retry button.
IDIGNORE 5 The user chose the Ignore button.
IDYES  6 The user chose the Yes button.
IDNO  7 The user chose the No button.

cMessageText

指定在对话框中显示的文本。在 cMessageText 中包含回车符 (CHR(13)) 可以使信息移到下一行显示。对话框的高度和宽度根据 cMessageText 适当增大,以包含全部信息。

nDialogBoxType

指定对话框中的按钮和图标、显示对话框时的默认按钮以及对话框的行为。
在下面的表中,对话框按钮值从 0 到 5 指定了对话框中显示的按钮。图标值 16、32、64 指定了对话框中的图标。默认值 0、256、512 指定对话框中哪个按钮为默认按钮。当显示对话框时选中此默认按钮。
当省略 nDialagBoxType 时,等同于指定 nDialagBoxType 值为0。

数值    对话框按钮
0    仅有“确定”按钮
1    “确定”和“取消”按钮
2    “放弃”、“重试”和“忽略”按钮
3    “是”、“否”和“取消”按钮
4    “是”、“否”按钮
5    “重试”和“取消”按钮
数值    图标
16    “停止”图标
32    问号
48    惊叹号
64    信息 (i) 图标

数值    默认按钮
0    第一个按钮
256    第二个按钮
512    第三个按钮

nDialogBoxType 可以是三个值的和从上面每个表中选一个值。例如,若 nDialogBoxType 为 290(
2+32+256),则指定的对话框含有如下特征:

?   “放弃”、“重试”或“忽略”按钮。
?   消息框显示问号图标。
?   第二个按钮,“重试”为默认按钮。

cTitleBarText

指定对话框标题栏中的文本。若省略 cTitleBarText,标题栏中将显示“Microsoft Visual FoxPro”

返回值类型

数值型

说明

MESSAGEBOX( ) 的返回值标明选取了对话框中的哪个按钮。在含有取消按钮的对话框中,如果按下 ESC 键退出对话框,则与选取“取消”按钮一样,返回值 (2)。
注意本函数的最短缩写为 MESSAGEB( )。
下表列出了 MESSAGEBOX( ) 对应每个按钮的返回值。

返回值    按钮
1    确定
2    取消
3    放弃
4    重试
5    忽略
6    是
7    否


可在命令窗口中具体试试如下代码:

MESSAGEBOX("试验", 3+64+512, "aaa")
                   |  |  |
                   |  |  0 256 512 
                   |  16 32 48 64
                    0 1 2 3 4 5

原创粉丝点击