MessageBox

2015-04-24 10:46:03  访问(2114) 赞(0) 踩(0)

 1: void CDialogsDlg::OnYesnocancel() 
 2: {
 3:     // TODO: Add your control notification handler code here
 4: 
 5:     ///////////////////////
 6:     // MY CODE STARTS HERE
 7:     ///////////////////////
 8: 
 9:     int iResults; // This variable will capture the button selection
10: 
11:     // Ask the user
12:     iResults = MessageBox("Press the Yes, No, or Cancel button",
13:                 "Yes, No, Cancel Dialog", 
14:                 MB_YESNOCANCEL | MB_ICONINFORMATION);
15: 
16:     // Determine which button the user clicked
17:     // Give the user a message showing which button was clicked
18:     switch (iResults)
19:     {
20:     case IDYES:    // The Yes button?
21:         m_sResults = "Yes! Yes! Yes!";
22:         break;
23:     case IDNO:    // The No button?
24:         m_sResults = "No, no, no, no, no.";
25:         break;
26:     case IDCANCEL:    // The Cancel button?
27:         m_sResults = "Sorry, canceled.";
28:         break;
29:     }
30: 
31:     // Update the dialog
32:     UpdateData(FALSE);
33: 
34:     ///////////////////////
35:     // MY CODE ENDS HERE
36:     ///////////////////////

37: }


标签:MessageBox 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)