[英]Waiting for another application window
What is the best way (with a view to optimization and using system resources) to make waiting in my application when window of another app will be shown? 当显示另一个应用程序的窗口时,在我的应用程序中等待的最佳方法是什么(以优化和使用系统资源为目的)?
For example: 例如:
How to accomplish item 2? 如何完成第2项? I know only one possible way: just check if handle exists in loop using
FindWindow
. 我只知道一种可能的方法:只使用
FindWindow
检查句柄是否存在于循环中。 But I hope there is a more smart solution exists. 但我希望存在更智能的解决方案。
If you launched the process (with CreateProcess
) use WaitForInputIdle
and then start the FindWindow
loop. 如果启动了该过程(使用
CreateProcess
),请使用WaitForInputIdle
,然后启动FindWindow
循环。 Adding a Sleep(20)
or something to the loop will ensure your resource usage is minimal. 在循环中添加
Sleep(20)
或其他内容将确保您的资源使用最少。
I dont think the same... I think the best way is windows hooking process... USING HOOKS 我不这么认为...我认为最好的方法是Windows挂钩过程... 使用钩子
... Please see: WH_CBT and you have to be watching the event: HCBT_CREATEWND ...请参阅: WH_CBT ,您必须观看事件: HCBT_CREATEWND
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.