I want to check when the window of an external application (a Poker On Line Game Table) jumps over all other windows because it's my turn to play.
The problem is that the Game table jumps in the foreground... but the window DOES NOT BECOME ACTIVE... this means that I can't check if it is jumped over all the other visible windows by the API GetForegroundWindow (and in fatc this API continue to return the Handle of the previous window, also if it is UNDER the Game Table that is jumped over ALL the desktop windows). Also the GetTopWindow API don't works.
Now the question is: how to find the handle of the top VISIBLE window (the window that is over all the other open windows for my eyes) also if it is not active???
No, the Window IS NOT a TopMost window: in fact if I click on another window it goes in background. If it should be a TopMost window it would remain on the top.
Probably it is put in the foreground by a WM_SHOW or WM_NOACTIVATE flag.
However, you can obtain the window handle by calling FindWindow() . This function retrieves a window handle based on a class name or window name. Call GetConsoleTitle() to determine the current console title. Then supply the current console title to FindWindow() .
A Windows window is identified by a "window handle" ( HWND ) and is created after the CWnd object is created by a call to the Create member function of class CWnd . The window may be destroyed either by a program call or by a user's action.
EnumWindows
and possibly WindowFromPoint
API functions. You can use them via P/Invoke in your VB.NET application and be able to find windows either in top to bottom order (EnumWindows) checking their location, caption etc on the way to identify the window of your interest, or directly locate the window at certain position (WindowFromPoint; I thought your window of interested might be popping up in the center of the screen, or centered by another window you already know or you can easily find it by its caption - this way you know the point of your interest on the screen already).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With