简体   繁体   中英

How do I make simple Windows error message box in Dev-C++?

I'm trying to make Windows message box that is shown in this page

I'm using latest Dev-C++ .

My current code is this:

#include <windows.h>

 int DisplayResourceNAMessageBox() {
    int msgboxID = MessageBox(
        NULL,
        (LPCWSTR)L"Resource not available\nDo you want to try again?",
        (LPCWSTR)L"Account Details",
        MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2
    );

    switch (msgboxID)
    {
    case IDCANCEL:
        // TODO: add code
        break;
    case IDTRYAGAIN:
        // TODO: add code
        break;
    case IDCONTINUE:
        // TODO: add code
        break;
    }

    return msgboxID; }

I get bunch of errors like:

"MB_CANCELTRYCONTINUE undeclared", "IDTRYAGAIN undeclared", etc.

I'm absolute noob, what do I do?

Heres the code for windows.h:

MessageBox(NULL, "An error has occurred!", "Title!", MB_ICONERROR | MB_OK);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM