FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Window in the foreground
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Window in the foreground
Posted: Thu Sep 15, 2022 07:06 AM

Hi,

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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Window in the foreground
Posted: Thu Sep 15, 2022 07:01 PM

This way you put a window foreground

SetForeGroundWindow( oWnd:hWnd )

Next, do you want to close it ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Window in the foreground
Posted: Thu Sep 15, 2022 07:08 PM

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 ?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Window in the foreground
Posted: Thu Sep 15, 2022 07:26 PM
Code (fw): Select all Collapse
if GetForeGroundWindow() == oWndMain:hWnd
   MsgInfo( "you app is in foreground" )
endif

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

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Window in the foreground
Posted: Thu Sep 15, 2022 08:21 PM

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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Window in the foreground
Posted: Thu Sep 15, 2022 08:28 PM

It seems as EVENT_SYSTEM_FOREGROUND is the event to check

Lets look for some examples...

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Window in the foreground
Posted: Fri Sep 16, 2022 08:41 AM

I'll try using EVENT_SYSTEM_FOREGROUND. Or I'll just check GetForegroundWindow() == oWndMain:hWnd in the timer

Continue the discussion