第一个对话框

来源:互联网 发布:js解析url获取参数 编辑:程序博客网 时间:2024/06/06 18:01

// DEMO2_2.CPP - a simple message box
#define WIN32_LEAN_AND_MEAN  //这句的目的是指示编译器不要包含与MFC相关的操作。

#include <windows.h>        // the main windows headers
#include <windowsx.h>       // a lot of cool macros

// main entry point for all windows programs
int WINAPI WinMain(HINSTANCE hinstance,
          HINSTANCE hprevinstance,
          LPSTR lpcmdline,
          int ncmdshow)
{
// call message box api with NULL for parent window handle
MessageBox(NULL, "对话框内容",
                 "标题",
                  MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION);

// exit program
return(0);

} // end WinMain


MessageBox(窗体句柄,内容,标题,按钮样式|图标)

其中对话框弹出的内容有

  • MB_ABORTRETRYIGNORE   The message box contains three pushbuttons: Abort, Retry, and Ignore.(终止重试忽略)

  • MB_OK   The message box contains one pushbutton: OK.

  • MB_OKCANCEL   The message box contains two pushbuttons: OK and Cancel.

  • MB_RETRYCANCEL   The message box contains two pushbuttons: Retry and Cancel.

  • MB_YESNO   The message box contains two pushbuttons: Yes and No.

  • MB_YESNOCANCEL   The message box contains three pushbuttons: Yes, No, and Cancel.

对话框图标:

  • MB_ICONEXCLAMATION   An exclamation-point icon appears in the message box.(!)

  • MB_ICONINFORMATION   An icon consisting of an "I" in a circle appears in the message box.(infomation信息)

  • MB_ICONQUESTION   A question-mark icon appears in the message box.(?)

  • MB_ICONSTOP   A stop-sign icon appears in the message box.(X)

原创粉丝点击