确定是否单击了消息框按钮YES或NO(MB_YESNO) [英] Determine if message box button YES or NO was clicked (MB_YESNO)

查看:84
本文介绍了确定是否单击了消息框按钮YES或NO(MB_YESNO)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在vc ++控制台应用程序中使用消息框,如何知道我点击了哪个按钮是或否?

这是一块代码我粘贴,我做了请检查一次,任何人都可以建议我什么是错的?



Hi,
I am using message box in vc++ console application, in that how to know which button i clicked YES or NO?.
Here is the piece of code i am pasting, which i did please check once and anyone can suggest me whats the wrong??

if(MessageBox(HWND_DESKTOP, L"License Failed", L"Get License",  MB_YESNO) == IDYES)
        {
            return;// even i am clicking on YES or NO whatever button am i pressing, its not entering inside this block
        }





根据我的要求,如果我按YES我需要进入里面。

请指导我,怎么回事。



注意:我通过将HWND_DESKTOP替换为NULL来检查同样的事情,仍然无效。



As per my requirement if i press YES I need to enter inside.
Please guide me, whats wrong.

Note: i checked the same thing by replacing HWND_DESKTOP with NULL, still not working.

推荐答案

返回什么:

what does it return:
int rc = MessageBox(HWND_DESKTOP, L"License Failed", L"Get License",  MB_YESNO);



您是否重新定义了MB_YESNO,IDYES或您的范围内的MessageBox用户功能? (不要这样做!!!)

阅读 MessageBox 文档。



写错了。


Have you redefined MB_YESNO, IDYES or is MessageBox user func in your scope? (Don't do it!!!)
Read the MessageBox documentation.

Write what was wrong.


我知道了什么我做错了。



实际上我从我使用MessageBox的块返回,而不是从主应用程序返回。所以我在主应用程序中添加了MessageBox验证而不是子函数。



谢谢大家的建议。
I got it whats the wrong i made.

actually i am returning from the block in which i am using the MessageBox, not from the the main application. So i added that MessageBox verification in main application instead in sub function.

Thank you all for your suggestions.


这篇关于确定是否单击了消息框按钮YES或NO(MB_YESNO)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆