zoukankan      html  css  js  c++  java
  • MessageBox函数

        windows API的MessageBox还是蛮好玩的吧,而且也比较常用嘛,下面就简单介绍一下。

    int WINAPI MessageBox(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,UINT uType);

        第一个参数传递父窗口句柄,没有的话就用NULL。

        第二个参数传递消息框的内容。

        第三个参数传递消息框的标题。

        第四个参数传递消息框的样式。

        

    #include<windows.h>
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
    {
        int answer;
    
        answer=MessageBox(NULL, TEXT("Do you love me?"), TEXT("Question"), MB_ICONQUESTION | MB_YESNO);
        if (IDYES == answer)
            MessageBox(NULL, TEXT("You said yes? Oh,my god!"), TEXT("我惊讶的回复道"), MB_OK | MB_ICONINFORMATION);
        else
            MessageBox(NULL, TEXT("That is a pity."), TEXT("我失望的回复道"), MB_OK | MB_ICONERROR);
        return 0;
    }

        就我所常用的,MessageBox返回值有

        IDOK IDYES IDNO IDCANCEL IDIGNORE IDRETRY IDABORT

        样式有

        MB_YESNO MB_OK MB_YESNOCANCEL 

        图标样式有

        MB_ICONERROR MB_ICONSTOP MB_ICONINFORMATION MB_ICONQUESTION MB_ICONWARNING

  • 相关阅读:
    Codeforces 526D Om Nom and Necklace (KMP)
    HDU
    HDU
    Codeforces 219D
    HDU
    HDU
    POJ
    HDU
    HDU
    第二次作业
  • 原文地址:https://www.cnblogs.com/inori/p/4988380.html
Copyright © 2011-2022 走看看