How to display error messages?

10898 단어
Try this one, it displays four different styles messages, maybe you get the idea of how message boxes work. The last one prompts you with a question.

  
  
  
  
  1. #include <windows.h>
  2. int main(int argc, char* argv[])
  3. {
  4. MessageBox(NULL, "Serious error", "<Message title here>", MB_ICONSTOP|MB_SETFOREGROUND);
  5. MessageBox(NULL, "Warning", "<Message title here>", MB_ICONEXCLAMATION|MB_SETFOREGROUND);
  6. MessageBox(NULL, "Info", "<Message title here>", MB_ICONINFORMATION|MB_SETFOREGROUND);
  7. if(IDYES == MessageBox(NULL, "Click Yes or No",
  8. "<Message title here>",
  9. MB_ICONQUESTION|MB_YESNO|MB_SETFOREGROUND))
  10. {
  11. MessageBox(NULL, "You clicked Yes",
  12. "<Message title here>",
  13. MB_ICONINFORMATION|MB_SETFOREGROUND);
  14. }
  15. else
  16. {
  17. MessageBox(NULL, "You clicked No",
  18. "<Message title here>",
  19. MB_ICONINFORMATION|MB_SETFOREGROUND);
  20. }
  21. return 0;
  22. }
:http://www.daniweb.com/software-development/cpp/threads/109791/how-to-display-error-messages

좋은 웹페이지 즐겨찾기