messagebox 上的提示框图标类型有哪些?

Wizard00 2002-04-30 09:30:03
messagebox 上的提示框图标类型有哪些?
messagebox(application.handle,pchar('内容'),MB_OKCANCEL+MB_DEFBUTTON1)
中的MB_DEFBUTTON1可以有很多类型,比如 warning 之类的东西. 谢谢了

...全文
718 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
pp4268 2010-06-09
  • 打赏
  • 举报
回复
iiiiiiiiiiiiiiiiii
Wizard00 2002-05-03
  • 打赏
  • 举报
回复
真是的,知不知道我在问什么?

uwslxcs2 2002-05-01
  • 打赏
  • 举报
回复
你可以到Windows.pas里去找
love4cz 2002-05-01
  • 打赏
  • 举报
回复
Warning 惊叹号

Error 停止符号

Information 感叹符号

Confirmation 确认符号

Custom 无位图符号
Wizard00 2002-05-01
  • 打赏
  • 举报
回复
我是说,出的图标的类型,不是按纽的类型.
Cute_Rascal 2002-05-01
  • 打赏
  • 举报
回复
你自己试试看不就可以了么?
写上“MB_”,然后同时按下ctrl 和 space,挨个选择,看看有什么变化,不就中了。毕竟,编程这东西,问是必要的,但,重要的还是在你自己实践。
icesnowerls 2002-05-01
  • 打赏
  • 举报
回复
he MessageBox function creates, displays, and operates a message box. The message box contains an application-defined message and title, plus any combination of predefined icons and push buttons.

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
);


Parameters

hWnd

Identifies the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.

lpText

Points to a null-terminated string containing the message to be displayed.

lpCaption

Points to a null-terminated string used for the dialog box title. If this parameter is NULL, the default title Error is used.

uType

Specifies a set of bit flags that determine the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.
Specify one of the following flags to indicate the buttons contained in the message box:

Flag 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.


Specify one of the following flags to display an icon in the message box:

Flag Meaning
MB_ICONEXCLAMATION,
MB_ICONWARNING
An exclamation-point icon appears in the message box.
MB_ICONINFORMATION, MB_ICONASTERISK
An icon consisting of a lowercase letter i in a circle appears in the message box.
MB_ICONQUESTION A question-mark icon appears in the message box.
MB_ICONSTOP,
MB_ICONERROR,
MB_ICONHAND
A stop-sign icon appears in the message box.


Specify one of the following flags to indicate the default button:

Flag Meaning
MB_DEFBUTTON1 The first button is the default button. MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
MB_DEFBUTTON2 The second button is the default button.
MB_DEFBUTTON3 The third button is the default button.
MB_DEFBUTTON4 The fourth button is the default button.


Specify one of the following flags to indicate the modality of the dialog box:

Flag Meaning
MB_APPLMODAL The user must respond to the message box before continuing work in the window identified by the hWnd parameter. However, the user can move to the windows of other applications and work in those windows. Depending on the hierarchy of windows in the application, the user may be able to move to other windows within the application. All child windows of the parent of the message box are automatically disabled, but popup windows are not.MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
MB_SYSTEMMODAL Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.
MB_TASKMODAL Same as MB_APPLMODAL except that all the top-level windows belonging to the current task are disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle available but still needs to prevent input to other windows in the current application without suspending other applications.


In addition, you can specify the following flags:

MB_DEFAULT_DESKTOP_ONLY

The desktop currently receiving input must be a default desktop; otherwise, the function fails. A default desktop is one an application runs on after the user has logged on.

MB_HELP

Adds a Help button to the message box. Choosing the Help button or pressing F1 generates a Help event.

MB_RIGHT

The text is right-justified.

MB_RTLREADING

Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.

MB_SETFOREGROUND

The message box becomes the foreground window. Internally, Windows calls the SetForegroundWindow function for the message box.

MB_TOPMOST

The message box is created with the WS_EX_TOPMOST window style.

MB_SERVICE_NOTIFICATION

Windows NT only: The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer.
If this flag is set, the hWnd parameter must be NULL. This is so the message box can appear on a desktop other than the desktop corresponding to the hWnd.
For Windows NT version 4.0, the value of MB_SERVICE_NOTIFICATION has changed. See WINUSER.H for the old and new values. Windows NT 4.0 provides backward compatibility for pre-existing services by mapping the old value to the new value in the implementation of MessageBox and MessageBoxEx. This mapping is only done for executables that have a version number, as set by the linker, less than 4.0.

To build a service that uses MB_SERVICE_NOTIFICATION, and can run on both Windows NT 3.x and Windows NT 4.0, you have two choices.

1. At link-time, specify a version number less than 4.0; or
2. At link-time, specify version 4.0. At run-time, use the GetVersionEx function to check the system version. Then when running on Windows NT 3.x, use MB_SERVICE_NOTIFICATION_NT3X; and on Windows NT 4.0, use MB_SERVICE_NOTIFICATION.


MB_SERVICE_NOTIFICATION_NT3X

Windows NT only: This value corresponds to the value defined for MB_SERVICE_NOTIFICATION for Windows NT version 3.51.



Return Values

The return value is zero if there is not enough memory to create the message box.
If the function succeeds, the return value is one of the following menu-item values returned by the dialog box:

Value Meaning
IDABORT Abort button was selected.
IDCANCEL Cancel button was selected.
IDIGNORE Ignore button was selected.
IDNO No button was selected.
IDOK OK button was selected.
IDRETRY Retry button was selected.
IDYES Yes button was selected.


If a message box has a Cancel button, the function returns the IDCANCEL value if either the ESC key is pressed or the Cancel button is selected. If the message box has no Cancel button, pressing ESC has no effect.

Remarks

When you use a system-modal message box to indicate that the system is low on memory, the strings pointed to by the lpText and lpCaption parameters should not be taken from a resource file, because an attempt to load the resource may fail.
When an application calls MessageBox and specifies the MB_ICONHAND and MB_SYSTEMMODAL flags for the uType parameter, Windows displays the resulting message box regardless of available memory. When these flags are specified, Windows limits the length of the message box text to three lines. Windows does not automatically break the lines to fit in the message box, however, so the message string must contain carriage returns to break the lines at the appropriate places.

If you create a message box while a dialog box is present, use the handle of the dialog box as the hWnd parameter. The hWnd parameter should not identify a child window, such as a control in a dialog box.
Windows 95: The system can support a maximum of 16,364 window handles.

See Also

FlashWindow, MessageBeep, MessageBoxEx, MessageBoxIndirect, SetForegroundWindow
icesnowerls 2002-05-01
  • 打赏
  • 举报
回复
应该是你自己不去查找一下,其实Delphi的帮助中有它的详细说明(Windows SDK)
Wizard00 2002-05-01
  • 打赏
  • 举报
回复
真是的,csdn的delphi果然没有效率,我已经知道了,答案如下:
函数功能:该函数创建、显示、和操作一个消息框。消息框含有应用程序定义的消息和标题,加上预定义图标与Push(下按)按钮的任何组合。

函数原型:int MessageBox(HWND hWnd,LPCTSTR IpCaption,UINT UType);

参数:

hWnd:标识将被创建的消息框的拥有窗口。如果此参数为NULL,则消息框没有拥有窗口。

IpText:指向一个以NULL结尾的、含有将被显示的消息的字符串的指针。

IpCaption:指向一个以NULL结尾的、用于对话框标题的字符串的指针。

uType:指定一个决定对话框的内容和行为的位标志集。此参数可以为下列标志组中标志的组合。

指定下列标志中的一个来显示消息框中的按钮,标志的含义如下。

MB_ABORTRETRYIGNORE:消息框含有三个按钮:Abort,Retry和Ignore。

MB_OK:消息框含有一个按钮:OK。这是缺省值。

MB_OKCANCEL:消息框含有两个按钮:OK和Cancel。

MB_RETRYCANCEL:消息框含有两个按钮:Retry和Cancel。

MB_YESNO:消息框含有两个按钮:Yes和No。

MB_YESNOCANCEL:消息框含有三个按钮:Yes,No和Cancel。

指定下列标志中的一个来显示消息框中的图标:标志的含义如下。

MB_ICONEXCLAMATION:

MB_ICONWARNING:一个惊叹号出现在消息框。

MB_ICONINFORMATION:

MB_ICONASTERISK:一个圆圈中小写字母i组成的图标出现在消息框。

MB_ICONOUESTION:一个问题标记图标出现在消息框。

MB_ICONSTOP:

MB_ICONERROR:

MM_ICONHAND:一个停止消息图标出现在消息框。

指定下列标志中的一个来显不缺省的按钮:标志的含义如下。

MB_DEFBUTTON1:第一个按钮为缺省按钮。如果MB_DEFBUTTON2,MB_DEFBUTTON3,MB_DEFBUTTON4没有被指定,则MB_DEFBUTTON1为缺省值。

MB_DEFSUTTON2;第二个按钮为缺省按钮。

MB_DEFBUTTON3:第三个按钮为缺省按钮。

MB_DEFBUTTON4:第四个按钮为缺省按钮。

指定下列标志中的一个来显示对话框的形态:标志的含义如卜。

MB_APPLMODAL:在hwnd参数标识的窗口中继续工作以前,用户一定响应消息框。但是,用户可以移动到其他线程的窗口且在这些窗口中工作。根据应用程序中窗口的层次机构,用户则以移动到线程内的其他窗口。所有母消息框的子窗口自动地失效,但是弹出窗口不是这样。如果既没有指定MB_SYSTEMMODAL也没有指定MB_TASKMOOAL,则MB_APPLMODAL为缺省的。

MB_SYSTEMMODAL:除了消息框有WB_EX_TOPMOST类型,MB_APPLMODAL和WS_EX_TOPMOST一样。用系统模态消息框来改变各种各样的用户,主要的损坏错误需要立即注意(例如,内存溢出)。如果不是那些与hwnd联系的窗口,此标志对用户对窗口的相互联系没有影响。

MB_TASKMODAL:如果参数hwnd为NULL,除了所有属于当前线程高层次的窗口足失效的,MB_TASKMODALL和MB_ApPLMODAL一样。当调用应用程序或库没有一个可以得到的窗口句柄时,使用此标志。但仍需要阻止到调用应用程序甲其他窗口的输入而不是搁置其他线程。

另外,可以指定下列标志。

MB_DEFAULT_DESKTOP_ONLy:接收输入的当前桌面一定是一个缺省桌面。否则,函数调用失败。缺省桌面是一个在用户已经纪录且以后应用程序在此上面运行的桌面。

MB_HELP:把一个Help按钮增加到消息框。选择Help按钮或按F1产生一个Help事件。

MB_RIGHT:文本为右调整。

MB_RTLREADING:用在Hebrew和Arabic系统中从右到左的顺序显示消息和大写文本。

MB_SETFOREGROUND:消息框变为前景窗口。在内部系统为消息个调用SetForegrundWindow函数。

MB_TOPMOSI:消息框用WS_EX_TOPMOST窗口类型来创建MB_SERVICE_NOTIFICATION。

Windows NT:调用程序是一个通知事件的用户的服务程序。函数在当前活动桌面上显示一个消息框,即使没有用户登记到计算机。

如果设置了此参数,则hwnd参数一定为NULL。所以消息框可以出现在一个桌面上而不是桌面响应参数hwnd。

对于Windows NT 4.0,MB_SERVICE_NOTIFICATION的值己经改变。对于旧的和新的值,请参见WINUSER。

Windows NT 4.O通过把旧值映射到MessageBox和MessageBoxEx执行中的新值,为先存在的服务程序提供逆兼容。此映射只为有了版本数目的可执行程序而做。

为了建立一个用MB_SERVICE_NOTIFICATION的服务器,且可以在Windows NT 3.X和Window NT 4.0上执行,可有两种选择。在连接时间,指定一个版本数目小于4.0的版本,或在连接时间,指定一个4.0版本。在运行时间,用函数GetVersionEx来检测系统版本,然后在Windows NT 3.X上用MB_SERVICE_NOTIFICATION_NT 3.x来运行和在Windows NT 4.0上用MB_SERVICE_NOTIFICAION来运行。MB_SERVCE_NOTIFICATION_NT3.x(WindowNT)此值响应于为WindowNT3.51的MB_SERVICE_NOTIFICAION

定义的值。

返回值:如果没有足够的内存来创建消息框,则返回值为零。如果函数调用成功,则返回值为下列对话框返回的菜单项目值中的一个:

IDABORT:Abort 按钮被选中。IDCANCEL:Cancel按钮被选中。IDIGNORE:Ignore按钮被选中。

IDNO:NO按钮被选中。IDOK:OK按钮被选中。IDRETRY:RETRY按钮被选中。

IDYES:YES按钮被选中。

如果一个消息框有一个Cancel按钮,且如果Esc键被按下或Cancel键被选择,则函数返回IDCANCEL值。如果消息框没有Cancel按钮,则按Esc键没有作用。

备注:当创建一个系统模态消息框来表示系统在内存的低端中时,由lpTeXt和lpCaption参数指向的字符串不应该从一个资源文件中取出,因为试图装载此资源可能导致失败。

当一个应用程序调用MessageBox,且为uType参数指定MB_ICONHAND和MB_SYSTEMMODAL标志时,系统不管可用内存为多少,直接显示结果消息框。当这些标志被指定,系统把消息框文本的长度局限于三行。系统不能自动截断要填到消息框的行,但是消息字符串一定含有回车换行,以在合适的位置换行。

如果在对话框出现的的同时创建了消息框,则可使用对话框的句柄作为hwnd参数,hwnd参数不应该标识一个子窗口,例如对话框中的一个控制。

Windows 95:系统可以支持最大达16364个窗口句柄。

Windows CE:Windows CE 不支持uType参数的下列值:

MB_STSTEMMODAL;MB_TASKMODAL;MB_HELP;MB_RTLREADING;MB_DEFAULT_DESKTOP_ONLY;

MB_SERVICE_NOTIFICATION;MB_USERICON。

不支持下列返回值:IDCLOSE;IDHELP
Wizard00 2002-05-01
  • 打赏
  • 举报
回复
to :hxshanji
delphi 好象也不认这个,给个例子好么?谢谢.
Wizard00 2002-05-01
  • 打赏
  • 举报
回复
TO LOVE$CZ(~-~):
好象系统不认识这个,说没定义,问一下,是直接加在MB_okcancel 后面么?能不能
给一个示范的例子,谢谢.
hxshanji 2002-04-30
  • 打赏
  • 举报
回复
风格
smsInformation The message box informs the user of something that happens in the course of normal operation.

smsWarning The message box warns the user of the consequences of what is happening.

smsCritical The message box provides the user of critical information. Typically, this is the result of an exception or error.

按钮
smbOK A button with the caption ‘OK’
smbCancel A button with the caption ‘Cancel’
smbYes A button with the caption ‘Yes’
smbNo A button with the caption ‘No’
smbAbort A button with the caption ‘Abort’
smbRetry A button with the caption ‘Retry’
smbIgnore A button with the caption ‘Ignore’
suary 2002-04-30
  • 打赏
  • 举报
回复
提示,警告,

5,379

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧