OVH Cloud OVH Cloud

contrôle d'une application

1 réponse
Avatar
Malaussene
Bonjour à tous

Est-il possible et si oui comment de savoir si une application dont j'ai
le nom est active?

Merci

1 réponse

Avatar
ng
Salut,

Qu'appelles-tu le nom ? Le titre ? Le chemin ?

Pour le titre :

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long

Public Function EstActive(strTitre As String) As Boolean
'//si t'as le classname, c'est plus sûr
EstActive = (FindWindow(vbNullString, strTitre) = GetForegroundWindow)
End Function

Exemple :

MsgBox EstActive("Calculatrice") '//Renvoie True si la fenêtre est active

--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/

Malaussene a écrit :

Bonjour à tous

Est-il possible et si oui comment de savoir si une application
dont j'ai le nom est active?

Merci