- 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
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