MFC CDialog/CDialogEx DoModal ALT
Questions:
I'm using MFC CDialog/CDialogEx to show a modal dialog with DoModal.
usually it works without problems, but sometimes, the dialog wont show up until I press ALT key.
the scenarios is, I have a timer in the parent window, and doing some work in the OnTimer function, if the work takes too much time, say, longer than the timer interval, then DoModal wont show the dialog window, until ALT key pressed.
I've traced the problem into CWnd::RunModalLoop() function in wincore.cpp
apparently it can only call ShowWindow() when the message loop is empty,
or, a message 0x118 (WM_SYSTIMER) or WM_SYSKEYDOWN (ALT key) is received.
since my parent window is always busy processing WM_TIMER message, the message queue will never be empty, it will never call ShowWindow() to display the dialog window, until I press ALT key.
I think is behaviour is unexpected.
Answers:
Hello,
Thanks again for the report. We have investigated this issue and we feel that it is by design. All time-consuming operations should be placed in separate (working) threads and then pass progress info to the main GUI thread. This MSDN topic has more information:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd744765(v=vs.85).aspx
I hope this helps.
Pat Brenner
Visual C++ Libraries Development
Solutions:
call CWnd::PostMessage(0x118) before DoModal();
MFC CDialog/CDialogEx DoModal ALT的更多相关文章
- MFC Initinstance中DoModal()返回-1
新建一个基于对话框的MFC应用程序,在App的Initinstance中调用对话框DoModal()来显示对话框,这是框架的内容,应用程序框架生成的全部是正常的. 当把我对话框的资源文件提取到一个资源 ...
- MFC无法使用CDialogEx类
在stdafx.h中添加以下代码: #include <afxcontrolbars.h>
- CDialog与CDialogEx的区别联系
CDialogEx是VS2003之后出现的,VC++6.0没有.CDialogEx = CDialog ExtendExtend的意思是扩展,即扩展的CDialog! 这个类是CDialog的扩展类, ...
- DoModal时带出次级窗口闪现
最近在做MFC 界面开发. 在一个CDialog窗口DoModal模态显示时, 会将次级窗口带出闪现(比如将一个窗口active, 然后点击我现在程序需要弹框的按钮,弹出弹出正常,但原来active的 ...
- MFC笔记5
1.MessageBox() 引用自(http://www.douban.com/note/40199603/) 一 函数原型及参数 function MessageBox(h ...
- VC++ CArchive及简单的文件操作方法
CArchive 方法用于存取文件 我向你推荐的是使用CArchive,它的使用方法简单且功能十分强大.首先还是用CFile声明一个对象,然后用这个对象的指针做参数声明一个CArchive对象,你就可 ...
- VC的文件操作
各种关于文件的操作在程序设计中是十分常见,如果能对其各种操作都了如指掌,就可以根据实际情况找到最佳的解决方案,从而在较短的时间内编写出高效的代码,因而熟练的掌握文件操作是十分重要的.本文将对Visua ...
- CFile、CStdioFile、FILE和其他文件操作(转+总结)
CFile.CStdioFile.FILE和其他文件操作(转+总结) 2010-04-10 20:36:33| 分类: VC++|举报|字号 订阅 下载LOFTER我的照片书 | ...
- VC++文件操作之最全篇
一.剖析VC中的文件操作 各种关于文件的操作在程序设计中是十分常见,如果能对其各种操作都了如指掌,就可以根据实际情况找到最佳的解决方案,从而在较短的时间内编写出高效的代码,因而熟练的掌握文件操作是十分 ...
随机推荐
- SpringMVC之六:Controller详细介绍
一.简介 在SpringMVC 中,控制器Controller 负责处理由DispatcherServlet 分发的请求,它把用户请求的数据经过业务处理层处理之后封装成一个Model ,然后再把该Mo ...
- zk 05之:ZooKeeper的配置
ZooKeeper 的功能特性通过 ZooKeeper 配置文件来进行控制管理( zoo.cfg 配置文件). ZooKeeper 这样的设计其实是有它自身的原因的.通过前面对 ZooKeeper 的 ...
- Nuget-QRCode:jquery-qrcode
ylbtech-Nuget-QRCode:jquery-qrcode 1.返回顶部 1. <!DOCTYPE html> <html> <head> <tit ...
- Binary Tree Inorder Traversal-非递归实现中序遍历二叉树
题目描述: 给定一颗二叉树,使用非递归方法实现二叉树的中序遍历 题目来源: http://oj.leetcode.com/problems/binary-tree-inorder-traversal/ ...
- msfvenom 摄像头
4.13 莫名其妙的心情不好 又回到了那个不想打游戏不想聊天不想说话的日子. 不用想.vm——>kali 很早以前看过用msfvenom生成木马的文章.然后……然后我的浏览器就崩溃了.Firef ...
- JavaScript高级程序设计学习笔记第五章--引用类型(函数部分)
四.Function类型: 1.函数定义的方法: 函数声明:function sum (num1, num2) {return num1 + num2;} 函数表达式:var sum = functi ...
- JavaScript高级程序设计学习笔记第四章--变量、作用域和内存问题
1.变量可能包含两种不同数据类型的值:基本类型值和引用类型值. 基本类型值指的是简单的数据段,而引用类型值指那些可能由多个值构成的对象. 2.变量复制 如果从一个变量向另一个变量复制基本类型的值,会在 ...
- js操作Iframe非当前最上层窗体
如果当前窗口不是最上层窗口(比如是在Iframe中),那么就把自己变为最上层窗口. <script language="javascript" type="tex ...
- 错误:(26, 13) Failed to resolve: com.android.support:appcompat-v7:27.+
小编也是初学安卓,今天配置环境的时候遇到这个问题了,搞了半天终于找到了问题 在build.gradle中添加 allprojects { repositories { jcenter() maven ...
- sorted matrix - search & find-k-th
sorted matrix ( Young Matrix ) search for a given value in the matrix: 1) starting from upper-right ...