I have a situation where I need to capture windowstate changes of another window (which is not owned by my application and I didn't wrote it. I think it's written in C++).
Actually I'm using a separate thread where I constantly do GetWindowState and fire custom events when this value changes (I have the handle of the window), but I would like to know if there is a better method
Thanks,
P.S. I'm using winform if can be useful in any way
You can hook WNDPROC and intercept messages with that. You can either inject a DLL into the target process, open the process with debug priveleges or set a global hook to WH_CALLWNDPROC.