开发者

How can I know if a window belongs to my program? Using win32 only

开发者 https://www.devze.com 2023-01-01 09:07 出处:网络
How can I know if a window belongs to my program? I guess I can use the window handle to get 开发者_StackOverflow中文版the executable name but that seems like a lot of work and I have to do this repea

How can I know if a window belongs to my program? I guess I can use the window handle to get 开发者_StackOverflow中文版the executable name but that seems like a lot of work and I have to do this repeatedly so I think it might be a performance issue. Is there a simple way to know if a given window handle is from ones own program with win32 or some OS construct? Can't use window titles either due to the nature of this application.


Call GetWindowThreadProcessId and compare the returned process Id against your own (via GetCurrentProcessId) seems simple.

0

精彩评论

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