
Find out if my app is the active app
Hi Leonardo,
Try the GetForegroundWindow() API.
Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" ()
As Long
You can check if your app is active like this:
If MyForm.hWnd = GetForegroundWindow() then
'App is active
Else
'Some other app is active
End if
Also, you can subclass your window and process the WM_ACTIVATEAPP message to
find when your app is being activated or deactivated.
Regards,
Stoil
Quote:
> Hello,
> From my application's code, I need to know if my app is the active app of
> the system at that moment (that is, the app that has the "focus"). I browsed
> the Win32 API documentation, but didn't find a function that returned the
> active app.
> Does anyone know how can I achieve this?
> Thanks in advance,
> Leonardo Bosi
> Proximity Soft
> Buenos Aires, Argentina
> --------------------------------------------
> http://www.proximity.com.ar