Il faut faire un form avec un ListBox(list1) et un bouton (command1)
Ajoutez ce qui suit dans un module
Source / Exemple :
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Public Const GW_HWNDFIRST = 0
Public Const GW_HWNDNEXT = 2
<B>Puis mettez ce qui suit dans le code de votre form</B>
Private Sub Command1_Click()
Call ListeDesTaches
End Sub
Private Function ListeDesTaches()
On Error Resume Next
Dim CurrWnd As Long
Dim Length As Long
Dim NomTache As String
Dim Parent As Long
Dim NbListe As String
NbListe = 0
Me.List1.Clear
CurrWnd = GetWindow(Me.hwnd, GW_HWNDFIRST)
While CurrWnd <> 0
Parent = GetParent(CurrWnd)
Length = GetWindowTextLength(CurrWnd)
NomTache = Space$(Length + 1)
Length = GetWindowText(CurrWnd, NomTache, Length + 1)
NomTache = Left$(NomTache, Len(NomTache) - 1)
If Length <> 0 Then
If NomTache <> Me.Caption And NomTache <> "" Then
If IsWindowVisible(CurrWnd) Then
Me.List1.AddItem NomTache
End If
End If
End If
CurrWnd = GetWindow(CurrWnd, GW_HWNDNEXT)
DoEvents
Wend
End Function
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.