Public Declare Function IsWindowVisible Lib "user32" (ByVal hWnd As Long) As Boolean
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
' Renvoie la fenêtre propriétaire de la fenêtre
Public Const GWL_HWNDPARENT As Long = -8
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
'---------------------------------------------------------------------------------------
' Procedure : IsTask
' DateTime : 25/02/2007 18:52
' Author : Vb System Library
' Purpose : Renvoie TRUE si la fenêtre est une tâche (apparait dans le Ctrl Alt Suppr)
' Critères : - Visible
' - Avoir un titre
' - Pas de parent
' - Pas de propriétaire
' - ça ne doit pas etre le TaskManager (Progman)
' Params : hWnd : Handle de la fenetre
'---------------------------------------------------------------------------------------
Public Function IsTask(ByVal hWnd As Long) As Boolean
'le fenêtre doit être visible
If IsWindowVisible(hWnd) And (GetWindowLong(hWnd, GWL_HWNDPARENT) = 0) And Not (GetWindowTextLength(hWnd) = 0) Then
' Vérifie que ce n'est pas le TaskManager
If GetWindowClass(hWnd) <> "Progman" Then
IsTask = True
End If
End If
End Function
Le 28/02/2007 par MadMatt : Optimisation
Seul les admins et l'auteur du code lui même peuvent modifier ce code.