简体   繁体   English

如何在 Dev-C++ 中制作简单的 Windows 错误消息框?

[英]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我正在尝试制作此页面中显示的 Windows 消息框

I'm using latest Dev-C++ .我正在使用最新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. “MB_CANCELTRYCONTINUE 未声明”、“IDTRYAGAIN 未声明”等。

I'm absolute noob, what do I do?我绝对是菜鸟,我该怎么办?

Heres the code for windows.h:这是 windows.h 的代码:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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