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中的文件操作 各种关于文件的操作在程序设计中是十分常见,如果能对其各种操作都了如指掌,就可以根据实际情况找到最佳的解决方案,从而在较短的时间内编写出高效的代码,因而熟练的掌握文件操作是十分 ...
随机推荐
- The Tomcat server configuration at \Servers\Tomcat v8.0 Server at localhost-config is missing. Check the server for erro
解决方案 1.选择Eclipse工具栏中的Windows→Perferences 2.remove已经创建的server 3.选择Add重新添加,选择create anew local server ...
- linux svn 客户端基本使用命令
1.从svn获取项目 svn co URL --username XX --password XX; 2.添加code file svn add codeFile; svn ci -m "c ...
- AngularJs(Part 4)--Modules depending on other Modules
Angular does an excellent job of managing object dependencies. it can even take care of module depen ...
- PCL推荐的命名规范(2)
博客转载自:http://www.pclcn.org/study/shownews.php?lang=cn&id=210 函数/成员函数命名 函数和类的成员函数的命名应该采用camelCase ...
- Primer回顾 标准库类型
string类型的输入操作符: 1.读取并忽略开头所有的空白字符(如空格,换行符,制表符). 2.读取字符直至再次遇到空白字符,读取终止. 用getline读取整行文本 getline.接受两个参 ...
- 了解protected 以及公用、私有和受保护的继承
protected成员 可以认为protected访问标号是private 和public 的混合: 1.像private成员一样,protected成员不能被类的用户访问. 2.像public成员一 ...
- 《精通Spring4.X企业应用开发实战》读后感第四章
- SQL 分割字符串
USE [AppCloud] GO /****** Object: UserDefinedFunction [dbo].[splitstr] Script Date: 12/19/2013 09:33 ...
- Ubuntu 16 Mysql 安装配置
安装Mysql apt-get update; apt-get install mysql-server apt-get install mysql-client //安装过程中会提示修改密码 ...
- 3dmax视频
http://wenku.baidu.com/course/list/514?tagID=177