Welcome! Log In Create A New Profile

Advanced

[WD26] How to detect if the Application is in fore/background

Posted by Michael Drechsel 
[WD26] How to detect if the Application is in fore/background
October 20, 2021 03:11PM
Hi,

I need to know if the application is in foreground or background or minimized.

Winstatus(Win_Main) shows always "active".

Any Ideas ?

regards Michael
I don't know how to detect it at any given time, but you can manage flags and set them in several event codes:
- losing focus
- gaining focus
- changing dimension of window (where you can check for minimize)
Re: [WD26] How to detect if the Application is in fore/background
October 20, 2021 05:07PM
Hi Argus,

finally I use minimize. But the background flag is difficult to manage because "focus" is a property of a window an not the application.

If my application opens a child window, the main window has also not the focus.

regards Michael
Re: [WD26] How to detect if the Application is in fore/background
October 20, 2021 05:16PM
Hi Michael,

WinStatus [help.windev.com] is used to bring an app into the foreground and make it active.

Kind regards,
Guenter Predl
office@windev.at
Re: [WD26] How to detect if the Application is in fore/background
October 20, 2021 06:00PM
Hi Guenter,

see my post#1, this shows always "active". I need a method to check if the whole application is in fore or background.

regards Michael
Re: [WD26] How to detect if the Application is in fore/background
October 20, 2021 06:35PM
Hi Michael,

with WinStatus you SET it to TopActive which is what you want!?

Kind regards,
Guenter Predl
office@windev.at
Re: [WD26] How to detect if the Application is in fore/background
October 20, 2021 08:53PM
No, I must send notifications like Outlook if the Application is in the background.

regards Michael
as usual, there is a windows event for that: WM_ACTIVATEAPP

Source:

[stackoverflow.com]
Re: [WD26] How to detect if the Application is in fore/background
October 22, 2021 03:12PM
Hi Argus,

Bingo, thats what I´m looking for. Thx

regards Michael
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: