如何在MessageBox上执行我的代码Ok点击

Sim*_*ons 1 c++ windows mfc messagebox

这可能很简单,但我是MFC的新手.

我有一个消息框:

MessageBox("Do You Want to Save the Configuration Changes","NDS",1);
Run Code Online (Sandbox Code Playgroud)

哪个有Ok和Cancel选项.我想点击确定编写我的代码

Moo*_*ice 7

if(MessageBox("Blah", "NDS", 1) == IDOK)
{
   // they hit okay
}
Run Code Online (Sandbox Code Playgroud)

http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx

  • @Sunscreen,根据我提供的链接中的MSDN文档,`IDYES`被定义为6,而'IDOK`被定义为1.因此,尝试从使用`MB_OKCANCEL`标志调用的MessageBox中检查IDYES将不起作用将永远不会被退回. (2认同)