SetForeGroundWindow()和SetFocus()问题与对话框内的子模式对话框 [英] SetForeGroundWindow() and SetFocus() Issues with Child Modeless Dialog Inside a Dialog

查看:108
本文介绍了SetForeGroundWindow()和SetFocus()问题与对话框内的子模式对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,


我正在做一些传统的MFC工作,我正在尝试将焦点放在对话框中的子无模式对话框上。作为一个简单的测试,我在OnInitDialog()期间调用了SetForeGroundWindow()和SetFocus()。我的对话框无法获得焦点;但是,当我附加一个
断点并逐步执行代码时,SetForeGroundWindow()将正确设置焦点并且焦点仍然存在。


我不知道为什么代码仅适用于断点,不能在没有断点的情况下工作。


有没有人对此有任何见解?


谢谢,


Matthew

解决方案

我不确定为什么代码只能使用断点而不能在没有断点的情况下工作断点。

嗯,进程可以设置前台窗口的API规则包括 -
正在调试进程


SetForegroundWindow功能


Hello Everyone,

I'm doing some legacy MFC work and I'm trying to set focus on a child modeless dialog inside a dialog. As a simple test, I've made calls to SetForeGroundWindow() and SetFocus() during OnInitDialog(). My dialog will not get focus; however, when I attach a breakpoint and step through the code, SetForeGroundWindow() will properly set the focus and the focus persists after.

I'm not sure why the code works only with a breakpoint and no longer works without a breakpoint.

Does anyone have any insight into this?

Thanks,

Matthew

解决方案

I'm not sure why the code works only with a breakpoint and no longer works without a breakpoint.

Well, the API rules for when a process can set the foreground window include - The process is being debugged.

SetForegroundWindow function


这篇关于SetForeGroundWindow()和SetFocus()问题与对话框内的子模式对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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