如何在MFC中将正在运行的应用程序和与众不同的应用程序置于前台 [英] How to bring a running and Different Application running to foreground in MFC

查看:102
本文介绍了如何在MFC中将正在运行的应用程序和与众不同的应用程序置于前台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,要求我检查特定的GUI.exe是否正在运行以及是否正在运行,然后需要将该GUI放在最前面.

我正在使用MFC和C ++,我面临的问题是我不知道如何在现有的MFC应用程序中检查GUI.exe,如果找到,则如何将其带到前台.

谢谢,

I have one requirement which asks me to check if a particular GUI.exe is running and if it is running then I need to bring that GUI to front.

I am using MFC and C++, The problem which I am facing is that I dont know how to check for GUI.exe in my existing MFC application and if Found, then how to bring it to Foreground.

Thanks,

推荐答案

您可以使用CreateToolhelp32SnapshotProcess32First/Process32NextEnumProcesses来按名称查找进程.

应该有现有的代码可以做到这一点(甚至在CodeProject上也可以).

之后,当您获得流程句柄时,可以尝试在流程句柄上使用MoveWindowSetWindowPos.

祝你好运.

M.
You can find a process by name with CreateToolhelp32Snapshot and Process32First/Process32Next or with EnumProcesses.

There should be existing code to do just that (probably even here on CodeProject).

After that, when you get the process handle, you could try to use MoveWindow or SetWindowPos on the process handle.

good luck.

M.


这篇关于如何在MFC中将正在运行的应用程序和与众不同的应用程序置于前台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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