开发者

Waiting for another application window

开发者 https://www.devze.com 2023-02-14 13:15 出处:网络
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?

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:

  1. My application starts.
  2. Waiting while, for example, Notepad will be started so i can get handle of its window.
  3. Using handle im doing something with it and then closing my app.

How to accomplish item 2? I know only one possible way: just check if handle exis开发者_StackOverflowts in loop using 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. Adding a Sleep(20) or something to the loop will ensure your resource usage is minimal.


I dont think the same... I think the best way is windows hooking process... USING HOOKS

... Please see: WH_CBT and you have to be watching the event: HCBT_CREATEWND

0

精彩评论

暂无评论...
验证码 换一张
取 消