Page 1 of 1

Window in the foreground

Posted: Thu Sep 15, 2022 7:06 am
by Natter
Hi,

Is it possible to get the FW application exit event to the foreground ?

Re: Window in the foreground

Posted: Thu Sep 15, 2022 7:01 pm
by Antonio Linares
This way you put a window foreground

SetForeGroundWindow( oWnd:hWnd )

Next, do you want to close it ?

Re: Window in the foreground

Posted: Thu Sep 15, 2022 7:08 pm
by Natter
I don't need to bring the application to the foreground. I just wanted to know if my app is in the foreground or not ?

Re: Window in the foreground

Posted: Thu Sep 15, 2022 7:26 pm
by Antonio Linares

Code: Select all | Expand

if GetForeGroundWindow() == oWndMain:hWnd
   MsgInfo( "you app is in foreground" )
endif

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getforegroundwindow

Re: Window in the foreground

Posted: Thu Sep 15, 2022 8:21 pm
by Natter
Thank you, Antonio!

Is it possible to intercept the moment when the window is in the foreground ? For example, my application is in the background. In the foreground is some other application. I am closing this application. As a result, my application comes to the fore. This is the moment I need to catch

Re: Window in the foreground

Posted: Thu Sep 15, 2022 8:28 pm
by Antonio Linares
It seems as EVENT_SYSTEM_FOREGROUND is the event to check

Lets look for some examples...

Re: Window in the foreground

Posted: Thu Sep 15, 2022 8:30 pm
by Antonio Linares

Re: Window in the foreground

Posted: Fri Sep 16, 2022 8:41 am
by Natter
I'll try using EVENT_SYSTEM_FOREGROUND. Or I'll just check GetForegroundWindow() == oWndMain:hWnd in the timer