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中的文件操作 各种关于文件的操作在程序设计中是十分常见,如果能对其各种操作都了如指掌,就可以根据实际情况找到最佳的解决方案,从而在较短的时间内编写出高效的代码,因而熟练的掌握文件操作是十分 ...
随机推荐
- POJ1144(割点入门题)
Network Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 11378 Accepted: 5285 Descript ...
- MFC ListBox 设置水平长度
在*.rc资源 设置可以水平滚动, 垂直滚动 但是 水平滚动无效,水平方向 一直无法显示 完整 设置代码如下 m_listBox.SetHorizontalExtent(2000); m_listBo ...
- 1.改变项目 动态库、静态库属性。 2.使用运行库 /MD、/MT、/LD说明
/MD./MT./LD(使用运行库) 有关 C 运行库以及使用 /clr(公共语言运行时编译) 进行编译时要使用哪些库的更多信息,请参见 CRT 库功能. 传递给链接器的给定调用的所有模块都必须使用相 ...
- shell 脚本学习之一 ------let,echo,变量
转自:http://blog.chinaunix.net/uid-26827001-id-3154024.html 首先看到好多以这样开头的 #!/bin/bash 这个是告诉系统 解释此脚 ...
- strTemp.Format ("%.*lf",3,600.0);
CString strTemp; strTemp.Format ("%.*lf",3,600.0); 这句话的含义?求指教 优质解答 这就是一个格式化输出,分号之前的CStri ...
- Ajax的调试错误信息的输出
error: function(xhr, status, error) { console.log(xhr); console.log(status); console.log(error); }
- 通用后台管理系统UI模板-AdminLTE简介及构造动态菜单栏
AdminLTE是一款基于bootstrap的后台管理系统的通用模板UI,它的样式美观且较为符合大多数后台管理系统的需求,典型的上|左右|下的布局形式.并且提供了一整套我们开发的时候可能用到的UI样式 ...
- 访问WEB-INF下JSP资源的几种方式(转)
访问WEB-INF下JSP资源的几种方式 方法一: 本来WEB-INF中的jsp就是无法通过地址栏访问的,所以安全. 如果说你要访问这个文件夹中的jsp文件需要在项目的web.xml文件中去配置ser ...
- poj1088滑雪最短路径
滑雪 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 97281 Accepted: 36886 Description ...
- UE4]不使用角色蓝图、动画蓝图、状态机,用“24K纯C++”实现动画播放
http://aigo.iteye.com/blog/2283454 原文作者:@玄冬Wong 不好意思,我稍稍标题党了,目前还不清楚如何用C++代码来实现BlendSpace和Montage的逻辑, ...