Page 1 of 1

Window moving into the background

PostPosted: Thu Oct 20, 2016 12:56 pm
by Natter
Hi all !

Can I handle the event of the window moving my tasks into the background ?

Re: Window moving into the background

PostPosted: Thu Oct 20, 2016 3:22 pm
by Antonio Linares
Your FWH app will receive the events and process them even if it is in background

Re: Window moving into the background

PostPosted: Thu Oct 20, 2016 8:46 pm
by Natter
I wanted to move my application on a second plan was carried out some actions

Re: Window moving into the background

PostPosted: Fri Oct 21, 2016 7:35 am
by Antonio Linares
Could you provide a small example to test here ? thanks

Re: Window moving into the background

PostPosted: Fri Oct 21, 2016 10:36 am
by Natter
DEFINE WINDOW oWnd //main window

DEFINE TIMER oTm OF oWnd INTERVAL 15000 ACTION Chk_Grnd()
oTm:Activate()

procedure Chk_Grnd

if oWnd is background (I don't know how to define it)
.............
else
.............
endif
return

Re: Window moving into the background

PostPosted: Fri Oct 21, 2016 7:33 pm
by Antonio Linares
> if oWnd is background (I don't know how to define it)

https://msdn.microsoft.com/es-es/library/windows/desktop/ms633505(v=vs.85).aspx

Code: Select all  Expand view
if GetForegroundWindow() != oWnd:hWnd

...

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HB_FUNC( GETFOREGROUNDWINDOW )
{
   hb_retnll( GetForegroundWindow() );
}

#pragma ENDDUMP
 

Re: Window moving into the background

PostPosted: Sat Oct 22, 2016 10:45 am
by Natter
Thank, Mr. Antonio. It's work fine !