tags:

views:

16

answers:

1

How can I know if a window belongs to my program? I guess I can use the window handle to get 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.

+1  A: 

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

Chris Becke
Awesome! Works perfectly! THANK YOU!
simba