岁月留声QtAsp

Qt in Linux , Asp Asp.net Jsp Php in Web

« SDI MDI[转]VC mschart示例 »

CDialog::DoModal

MFC Library Reference
CDialog::DoModal

Call this member function to invoke the modal dialog box and return the dialog-box result when done.

 
virtual INT_PTR DoModal( );

Return Value

An int value that specifies the value of the nResult parameter that was passed to the CDialog::EndDialog member function, which is used to close the dialog box. The return value is –1 if the function could not create the dialog box, or IDABORT if some other error occurred, in which case the Output window will contain error information from GetLastError.

Remarks

This member function handles all interaction with the user while the dialog box is active. This is what makes the dialog box modal; that is, the user cannot interact with other windows until the dialog box is closed.

If the user clicks one of the pushbuttons in the dialog box, such as OK or Cancel, a message-handler member function, such as OnOK or OnCancel, is called to attempt to close the dialog box. The default OnOK member function will validate and update the dialog-box data and close the dialog box with result IDOK, and the default OnCancel member function will close the dialog box with result IDCANCEL without validating or updating the dialog-box data. You can override these message-handler functions to alter their behavior.

Note   PreTranslateMessage is now called for modal dialog box message processing.

Example

void CTstApp::OnAppAbout(){   // Construct the dialog box passing the    // ID of the dialog template resource   CDialog aboutDlg(IDD_ABOUTBOX);   // Create and show the dialog box   INT_PTR nRet = -1;   nRet = aboutDlg.DoModal();   // Handle the return value from DoModal   switch ( nRet )   {   case -1:       AfxMessageBox("Dialog box could not be created!");      break;   case IDABORT:      // Do something      break;   case IDOK:      // Do something      break;   case IDCANCEL:      // Do something      break;   default:      // Do something      break;   };}

 

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

Search

  •  

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Spirit Build 80722 Code detection by Codefense

Copyright 2008-2011 京公网安备 110115000655 京ICP备09005635号 www.qtasp.cn WebSite. All Rights Reserved.