网站首页  词典首页

请输入您要查询的函数:

 

术语 messageboxex
释义 MessageBoxEx
语法:
int MessageBoxEx( HWND hWnd,
LPCTSTR lpText,
LPCTSTR lpCaption,
UINT uType,
WORD wLanguageId
);
MessageBoxEx功能
该MessageBoxEx函数创建,显示和操作一个消息框。该消息框包含一个应用程序定义的消息和标题,并加上任何预定义的图标和按钮的组合。按钮在系统的用户界面语言。
目前MessageBoxEx和这些URL相同的方式工作。
参数
hWnd
[in]句柄消息框的所有者窗口被创建。如果该参数为NULL,则消息框没有所有者窗口。
lpText
[in]指向一个空结束的字符串,其中包含的信息显示。
lpCaption
[in]指向一个空结束的字符串,其中包含对话框的标题。如果该参数为NULL,则默认标题错误使用。
uType
[in]指定的内容和对话框的行为。此参数可以是一个旗的旗以下群体的组合。
为了表示按钮显示在消息框中,指定下列值之一。
MB_ABORTRETRYIGNORE
该消息框包含三个按钮:中止,重试,和忽略。
MB_CANCELTRYCONTINUE
微软Windows 2000/XP的:该消息框包含三个按钮:取消,再试一次,继续。使用此消息框类型,而不是MB_ABORTRETRYIGNORE。
MB_HELP
Windows 95/98/Me中,Windows NT 4.0和更高版本:添加一个帮助按钮消息框。当用户单击帮助按钮或按F1,系统发送WM_HELP信息的主人。
MB_OK
该消息框包含一个按钮:确定。这是默认的。
MB_OKCANCEL
该消息框包含两个按钮:确定和取消。
MB_RETRYCANCEL
该消息框包含两个按钮:重试和取消。
MB_YESNO
该消息框包含两个按钮:是的,第
MB_YESNOCANCEL
该消息框包含三个按钮:是,否和取消。
要显示在消息框中的图标,指定下列值之一。
MB_ICONEXCLAMATION
感叹号点图标出现在消息框中。
MB_ICONWARNING
感叹号点图标出现在消息框中。
MB_ICONINFORMATION
一个图标的圆圈中的一个小写字母i组成的出现在消息框中。
MB_ICONASTERISK
一个图标的圆圈中的一个小写字母i组成的出现在消息框中。
MB_ICONQUESTION
问号图标出现在消息框中。在问号消息图标不再推荐,因为它没有清楚地代表了特定类型的信息,并因为作为信息措辞问题,适用于任何类型的消息。此外,用户可以通过帮助混淆信息消息的象征问号。因此,不要使用您的消息框这个问号消息的象征。该系统只支持继续将其列入为向后兼容。
MB_ICONSTOP
阿停止信号图标出现消息框。
MB_ICONERROR
阿停止信号图标出现消息框。
MB_ICONHAND
阿停止信号图标出现消息框。
为了表示默认的按钮,指定下列值之一。
MB_DEFBUTTON1
第一个按钮是默认按钮。
MB_DEFBUTTON1是,除非MB_DEFBUTTON2,MB_DEFBUTTON3,或MB_DEFBUTTON4是指定的默认。
MB_DEFBUTTON2
第二个按钮是默认按钮。
MB_DEFBUTTON3
第三个按钮是默认按钮。
MB_DEFBUTTON4
第四个按钮是默认按钮。
为了显示对话框的方式,指定下列值之一。
MB_APPLMODAL
用户必须响应消息框,然后继续在由hWnd参数确定的窗口工作。但是,用户可以移动到其他线程的窗户,在这些窗口工作。
根据不同层次的窗户在应用程序,用户可以在移动到其他窗口线程。的消息框的父母所有子窗口将自动禁用,但是弹出窗口不是。
MB_APPLMODAL是,如果不MB_SYSTEMMODAL也不MB_TASKMODAL是指定的默认。
MB_SYSTEMMODAL
作为MB_APPLMODAL相同,但该消息框有WS_EX_TOPMOST风格。使用系统模式消息框,通知用户的严重,可能造成损害的错误,需要立即注意(例如,内存不足)。此标志在用户的交互能力,窗户比hWnd有关的其他影响。
MB_TASKMODAL
作为MB_APPLMODAL相同,但所有顶层窗口属于当前线程被禁用,如果hWnd参数为NULL。使用此标志时,调用应用程序或库没有一个窗口句柄可用,但仍需要防止调用线程输入到其它窗口而暂停其他线程。
要指定其他选项,使用一个或多个下列值。
MB_DEFAULT_DESKTOP_ONLY
Windows NT/2000/XP的:相同,只是该系统将只显示在交互窗口站默认桌面的消息框MB_SERVICE_NOTIFICATION。有关更多信息,请参阅窗口站。
Windows NT 4.0和更早的版本:如果当前输入的桌面是不是默认的桌面,MessageBoxEx失败。
视窗2000/XP的:如果当前输入的桌面是不是默认的桌面,MessageBoxEx不会返回,直到用户切换到默认桌面。
在Windows 95/98/Me:此标志无效。
MB_RIGHT
文本右对齐。
MB_RTLREADING
显示消息和标题文本使用从右到左阅读的希伯来语和阿拉伯语系统的秩序。
MB_SETFOREGROUND
该消息框成为前台窗口。在内部,系统要求在消息框中SetForegroundWindow函数。
MB_TOPMOST
该消息框创建的WS_EX_TOPMOST窗口样式。
MB_SERVICE_NOTIFICATION
Windows NT/2000/XP的:来电者是一种服务通知用户的事件。该函数显示了当前活动桌面消息框,即使在没有用户登录到计算机。
终端服务:如果调用线程模拟令牌,该函数指示消息框,在指定的模拟令牌了会议。
如果设置此标志的hWnd参数必须为NULL。这是为了让消息框可以出现在桌面上的桌面比相应由hWnd其他。
欲了解更多有关微软与Windows NT 3.51和Windows NT 4.0中,更改信息,请参见备注。
有关安全注意事项方面的信息使用此标志,见互动服务。特别是,要注意这个标志可以产生在锁定桌面上的交互式内容,因此应该只用于非常有限的情况下,如资源枯竭。
MB_SERVICE_NOTIFICATION_NT3X
Windows NT/2000/XP的:此值对应于用于Windows NT 3.51版MB_SERVICE_NOTIFICATION定义的值。
欲了解更多有关在Windows NT 3.51和Windows NT 4.0中,更改信息,请参见备注。
wLanguageId
[in]指定用于在消息框中的按钮(拧显示的文本语言)。指定一个值为零(0)表示显示在默认的系统语言按钮上的文字。如果该参数MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),当前的语言与调用线程相关的使用。
要指定的语言比目前的其他语言,使用MAKELANGID宏以创建此参数。有关更多信息,请参见MAKELANGID。
返回值
如果一个消息框有一个取消按钮,则函数返回IDCANCEL值如果不是Esc键被按下或取消按钮被选中。如果消息框没有取消按钮,按下ESC键无效。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
如果函数成功,返回值为下列其中一个菜单项的值。
IDABORTAbort按钮被选中。
IDCANCELCancel按钮被选中。
IDCONTINUEContinue按钮被选中。
IDIGNOREIgnore按钮被选中。
IDNONo按钮被选中。
IDOKOK按钮被选中。
IDRETRYRetry按钮被选中。
IDTRYAGAINTry再次按钮被选中。
IDYESYes按钮被选中。
备注
当您使用系统模式消息框,表明该系统内存不足,字符串指向的lpText和lpCaption参数不应该从一个资源文件,因为采取的尝试加载资源可能会失败。
如果您创建一个消息框时出现一个对话框,目前,使用句柄作为hWnd参数对话框。在hWnd参数不能确定,如在一个对话框控件一个子窗口。
Windows 95/98/Me中:该系统可以支持最多16364窗口句柄。
Windows NT/2000/XP的:在MB_SERVICE_NOTIFICATION值的变化与Windows NT 4.0开始。 Windows NT 4.0提供向后映射旧价值的MessageBoxEx执行新的价值兼容性前现有的服务。完成此映射只可执行文件的版本号低于4.0的有,如连接器设置。
要构建一个服务,它使用MB_SERVICE_NOTIFICATION,并能同时运行在微软Windows NT 3.x和Windows NT 4.0中,您可以执行下列操作之一。
在链接时,指定版本号低于4.0以下
在链接时,指定版本4.0。在运行时,使用GetVersionEx函数来检查系统版本。然后,当运行在Windows NT 3.x中,使用MB_SERVICE_NOTIFICATION_NT3X和Windows NT 4.0上,使用MB_SERVICE_NOTIFICATION。
Windows 95/98/Me的:即使MessageBoxExW存在,它是支持Unicode的由Microsoft层在Windows 95/98/Me系统,向更一致的行为,在所有的Windows操作系统。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为ANSI和Unicode版本。
参见
对话框概述,MAKELANGID,MessageBeep,这些URL,MessageBoxIndirect,SetForegroundWindow
==英文原文==MessageBoxEx Function
The MessageBoxEx 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. The buttons are in the language of the system user interface.
Currently MessageBoxEx and MessageBox work the same way.
Syntax
int MessageBoxEx( HWND hWnd,
LPCTSTR lpText,
LPCTSTR lpCaption,
UINT uType,
WORD wLanguageId
);
Parameters
hWnd
[in] Handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.
lpText
[in] Pointer to a null-terminated string that contains the message to be displayed.
lpCaption
[in] Pointer to a null-terminated string that contains the dialog box title. If this parameter is NULL, the default title Error is used.
uType
[in] Specifies the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.
To indicate the buttons displayed in the message box, specify one of the following values.
MB_ABORTRETRYIGNORE
The message box contains three push buttons: Abort, Retry, and Ignore.
MB_CANCELTRYCONTINUE
Microsoft Windows 2000/XP: The message box contains three push buttons: Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE.
MB_HELP
Windows 95/98/Me, Windows NT 4.0 and later: Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends a WM_HELP message to the owner.
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.
To display an icon in the message box, specify one of the following values.
MB_ICONEXCLAMATION
An exclamation-point icon appears in the message box.
MB_ICONWARNING
An exclamation-point icon appears in the message box.
MB_ICONINFORMATION
An icon consisting of a lowercase letter i in a circle appears in the message box.
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. The question-mark message icon is no longer recommended because it does not clearly represent a specific type of message and because the phrasing of a message as a question could apply to any message type. In addition, users can confuse the message symbol question mark with Help information. Therefore, do not use this question mark message symbol in your message boxes. The system continues to support its inclusion only for backward compatibility.
MB_ICONSTOP
A stop-sign icon appears in the message box.
MB_ICONERROR
A stop-sign icon appears in the message box.
MB_ICONHAND
A stop-sign icon appears in the message box.
To indicate the default button, specify one of the following values.
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.
To indicate the modality of the dialog box, specify one of the following values.
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 threads 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 thread. All child windows of the parent of the message box are automatically disabled, but pop-up 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 thread 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 calling thread without suspending other threads.
To specify other options, use one or more of the following values.
MB_DEFAULT_DESKTOP_ONLY
Windows NT/2000/XP: Same as MB_SERVICE_NOTIFICATION except that the system will display the message box only on the default desktop of the interactive window station. For more information, see Window Stations .
Windows NT 4.0 and earlier: If the current input desktop is not the default desktop, MessageBoxEx fails.
Windows 2000/XP: If the current input desktop is not the default desktop, MessageBoxEx does not return until the user switches to the default desktop.
Windows 95/98/Me: This flag has no effect.
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, the system 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/2000/XP: 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.
Terminal Services: If the calling thread has an impersonation token, the function directs the message box to the session specified in the impersonation token.
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 more information on the changes between Microsoft Windows NT 3.51 and Windows NT 4.0, see Remarks.
For information on security considerations in regard to using this flag, see Interactive Services . In particular, be aware that this flag can produce interactive content on a locked desktop and should therefore be used for only a very limited set of scenarios, such as resource exhaustion.
MB_SERVICE_NOTIFICATION_NT3X
Windows NT/2000/XP: This value corresponds to the value defined for MB_SERVICE_NOTIFICATION for Windows NT version 3.51.
For more information on the changes between Windows NT 3.51 and Windows NT 4.0, see Remarks.
wLanguageId
[in] Specifies the language for the text displayed in the message box button(s). Specifying a value of zero (0) indicates to display the button text in the default system language. If this parameter is MAKELANGID (LANG_NEUTRAL, SUBLANG_NEUTRAL), the current language associated with the calling thread is used.
To specify a language other than the current language, use the MAKELANGID macro to create this parameter. For more information, see MAKELANGID.
Return Value
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.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
If the function succeeds, the return value is one of the following menu-item values.
IDABORTAbort button was selected.
IDCANCELCancel button was selected.
IDCONTINUEContinue button was selected.
IDIGNOREIgnore button was selected.
IDNONo button was selected.
IDOKOK button was selected.
IDRETRYRetry button was selected.
IDTRYAGAINTry Again button was selected.
IDYESYes button was selected.
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.
If you create a message box while a dialog box is present, use a handle to 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/98/Me: The system can support a maximum of 16,364 window handles.
Windows NT/2000/XP: The value of MB_SERVICE_NOTIFICATION changed starting with Windows NT 4.0. Windows NT 4.0 provides backward compatibility for pre-existing services by mapping the old value to the new value in the implementation of MessageBoxEx. This mapping is done only for executables that have a version number less than 4.0, as set by the linker.
To build a service that uses MB_SERVICE_NOTIFICATION, and can run on both Microsoft Windows NT 3.x and Windows NT 4.0, you can do one of the following.
At link-time, specify a version number less than 4.0
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.
Windows 95/98/Me: Even though MessageBoxExW exists, it is supported by the Microsoft Layer for Unicode on Windows 95/98/Me Systems to give more consistent behavior across all Windows operating systems.
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
UnicodeImplemented as ANSI and Unicode versions.
See Also
Dialog Boxes Overview , MAKELANGID , MessageBeep , MessageBox , MessageBoxIndirect , SetForegroundWindow
==原始网址==http://msdn.microsoft.com/en-us/library/ms645507(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 9:25:46