防止双击MFC对话框按钮 [英] Prevent double click on MFC-Dialog button

查看:84
本文介绍了防止双击MFC对话框按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在MFC C ++中开发Autocad/Bricscad对话框.知道我发现了一个更大的问题.有一个对话框为特殊"图形对象设置元数据.我使用此对话框(循环)更新每个特殊"图形对象的数据.因此,如果您有十个特殊"图形对象,则同一对话框将打开十次(成功).现在我有一个问题,用户有时会双击确定"按钮.但是,如果双击速度足够快,则该对话框下一个实例的确定"按钮将自动单击.我尝试了很多(例如,如果单击该按钮则禁用该按钮),但是没有任何解决方法.也许你们当中有人有个好主意.

i'm developing Autocad/Bricscad-Dialogs in MFC C++. Know i detected a bigger problem. There is a dialog which sets metadata for 'special' drawing objects. I update the data of every 'special' drawing object with this dialog (in a loop). So if you have ten 'special' drawing objects, the same dialog will open ten times (successively). Now i have the problem that the user sometimes make a double click on the "OK"-Button. But if this double click is fast enough, the "OK"-Button of the next instance of this dialog will clicked automatically. I tried a lot (for example disabling the button if it was clicked) but nothing solved my problem. Maybe someone of you have a good idea.

最诚挚的问候, 西蒙

推荐答案

打开新对话框时,您可以在进入常规消息循环之前刷新鼠标单击消息的消息队列,例如:

When you open a new dialog you can flush the message queue of mouse click messages before going into your normal message loop, e.g.:

MSG msg;
while (PeekMessage(&msg, hWndDlg, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE));

这篇关于防止双击MFC对话框按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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