弹出一个错误提示对话框

来源:互联网 发布:网络婚恋诈骗 编辑:程序博客网 时间:2024/03/29 01:10

windows下用int nResult = MessageBox(HWND  hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)实现一个消息窗

平台:visual studio C++ 2013 win32(非控制台)

语言:C++

说明:

1、hWnd = NULL表示直接在windows窗口下新建的一个子窗口

2、运行程序之前记得修改字符集,将工程属性页——常规——字符集 从Unicode改成使用多字节字符集

运行结果:


运行代码:

#include <Windows.h>using namespace std;INT WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR lpCmdLine, INT nShowCmd){int nResult = MessageBox(NULL, "运行错误,请选择对应选项", "错误提示框", MB_ICONERROR | MB_ABORTRETRYIGNORE);switch (nResult){case IDABORT:break;case IDRETRY:break;case IDIGNORE:break;}return 0;}


0 0
原创粉丝点击