• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

防止双击MFC对话框按钮

用户头像
it1352
帮助1

问题说明

我正在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.

最诚挚的问候, 西蒙

正确答案

#1

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

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));

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcghcgh
系列文章
更多 icon
同类精品
更多 icon
继续加载