home *** CD-ROM | disk | FTP | other *** search
/ Using Visual C++ 4 (Special Edition) / Using_Visual_C_4_Special_Edition_QUE_1996.iso / ch16 / msgbox.cpp < prev    next >
Encoding:
Text File  |  1995-11-13  |  602 b   |  25 lines

  1. // small fragment showing how to display a message box
  2. // when an error occurs and do something in response
  3.  
  4. // string table entry in resource file :
  5. IDS_SOCKET_ERR_OPEN    "Unable to Establish Connection, Retry or Cancel?"
  6.  
  7. // implementation code :
  8. CString prompt;
  9. prompt.LoadString(IDS_SOCKET_ERR_OPEN);
  10. UINT response = AfxMessageBox(prompt, MB_RETRYCANCEL | MB_ICONQUESTION);
  11. switch( response )
  12. {
  13.     case IDRETRY :
  14.     // try this again
  15.     break;
  16.  
  17.     case IDCANCEL :
  18.     // abandon this action
  19.     break;
  20.  
  21.     default:
  22.     // should never reach here, but just in case....
  23.     break;
  24. } // end switch
  25.