当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

清华大学电子工程系:《微机原理》MessageBox

资源类别:文库,文档格式:DOC,文档页数:3,文件大小:25.5KB,团购合买
MessageBox The 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.
点击下载完整版文档(DOC)

Message box e Message Box 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 Ip Text, / address of text in message box PCTSTR IpCaption, //address of title of message box UINT ulype / 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 ItExt Points to a null-terminated string containing the message to be displayed IpCapt Points to a null-terminated string used for the dialog box title. If this parameter is NULL, the default title error is used slype Specifies the contents and behavior of the dialog box. This parameter can be a combination of the following values MB ABORTRETRYIGNORE The message box contains three push buttons: Abort, Retry 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 value if neither MB SYSTEMMODAL nor

MessageBox The 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 the contents and behavior of the dialog box. This parameter can be a combination of the following values: Value Meaning MB_ABORTRETRYIGNORE The message box contains three push buttons: Abort, Retry, and Ignore. 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 value if neither MB_SYSTEMMODAL nor

MB TASKMODAL is specified 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 DEFBUTTONI The first button is the default button Note that the first button is al ways the default unless MB defbutton2. MB defbutton3. or MB DEfbutton4 is specified MB DEFBUTtON2 The second button is a default button MB DEFBUTTON3 The third button is a default button MB DEFBUTTON The fourth button is a default button MB HELP Windows 95: Adds a Help button to the message box. Choosing the Help button or pressing FI generates a Help event MB ICONASTERISK Same as MB ICONINFORMATION MB ICONERROR Windows 95: Same as MB ICONHAND MB ICONEXCLAMATION An exclamation-point icon appears in the message box. MB ICONHAND Same as MB Iconstop MB ICONINFORMATION An icon consisting of a lowercase letter i in a circle appears in the MB ICONQUESTIon A question-mark icon appears in the message box MB ICONSTOP A stop-sign icon appears in the message box MB ICONWARNING Windows 95: Same as MB ICONEXCLAMATION MB OK The message box contains one push button: OK 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 RIGHT Windows 95: The text is right-justified MB RTLREADING Windows 95: Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems MB SERVICE NOTIFICATION Windows NT: 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. MB SETFOREGROUND The message box becomes the foreground window. Internally Windows calls the Set Foreground window function for the message box MB SYSTEMMODAL All applications are suspended until the user responds to the Unless the application specifies MB ICONHAND, the message box does not become modal until after it is created; consequently, the owner window and other windows continue to receive messages resulting from its activation. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention(for example, running out of 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 MB YESNO The message box contains two push buttons: Yes and No

MB_TASKMODAL is specified. 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_DEFBUTTON1 The first button is the default button. Note that the first button is always the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified. MB_DEFBUTTON2 The second button is a default button. MB_DEFBUTTON3 The third button is a default button. MB_DEFBUTTON4 The fourth button is a default button. MB_HELP Windows 95: Adds a Help button to the message box. Choosing the Help button or pressing F1 generates a Help event. MB_ICONASTERISK Same as MB_ICONINFORMATION. MB_ICONERROR Windows 95: Same as MB_ICONHAND. MB_ICONEXCLAMATION An exclamation-point icon appears in the message box. MB_ICONHAND Same as MB_ICONSTOP. MB_ICONINFORMATION 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 A stop-sign icon appears in the message box. MB_ICONWARNING Windows 95: Same as MB_ICONEXCLAMATION. MB_OK The message box contains one push button: OK. 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_RIGHT Windows 95: The text is right-justified. MB_RTLREADING Windows 95: Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems. MB_SERVICE_NOTIFICATION Windows NT: 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. MB_SETFOREGROUND The message box becomes the foreground window. Internally, Windows calls the SetForegroundWindow function for the message box. MB_SYSTEMMODAL All applications are suspended until the user responds to the message box. Unless the application specifies MB_ICONHAND, the message box does not become modal until after it is created; consequently, the owner window and other windows continue to receive messages resulting from its activation. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). 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. 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 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 IDIGNOREIgnore 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 lp Text and lp Caption parameters should not be taken from a resource file because an attempt to load the resource may fail When an application calls Message Box and specifies the MB ICONHAND and MB SYSTEMMODAL flags for the u lype 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 only: The system can support a maximum of 16, 364 window handles

MB_YESNOCANCEL The message box contains three push buttons: Yes, No, and Cancel. Return Value 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 only: The system can support a maximum of 16,364 window handles

点击下载完整版文档(DOC)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
已到末页,全文结束
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有