1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| Private Sub Command1_Click()
Dim titre_fenetre As String
Dim handle As Long
Dim procid As Long
Dim nom_exe As String
Dim explorer_ProcessID As Long
Dim resul As Long
Dim lg_titre_fenetre As Long
Dim desktop_fenetre As Long
Text1.Text = ""
y = CreateToolhelp32Snapshot(2&, 0&)
retour.dwSize = Len(retour)
x = Process32First(y, retour)
Do While x = 1
nom_exe = Mid(retour.szExeFile & Chr(0), 1, InStr(1, retour.szExeFile, Chr(0), vbBinaryCompare) - 1)
nom_exe = Mid(nom_exe, InStrRev(nom_exe, "\", -1, vbBinaryCompare) + 1, Len(nom_exe) - InStrRev(nom_exe, "\", -1, vbBinaryCompare) + 1)
If (LCase(nom_exe) = "explorer.exe") Then
' sauvegarde de l'id du process explorer
explorer_ProcessID = retour.th32ProcessID
End If
Text1.Text = Text1.Text & nom_exe & vbCrLf
retour.dwSize = Len(retour)
x = Process32Next(y, retour)
Loop
' fermeture de l'handle snapshot
CloseHandle (y)
titre_fenetre = Space$(251)
lg_titre_fenetre = 250
desktop_fenetre = GetDesktopWindow()
t = GetWindow(desktop_fenetre, 5)
Do While t <> 0
resul = GetWindowTextA(t, titre_fenetre, lg_titre_fenetre)
If (resul > 0) Then
' If (LCase(Mid(titre_fenetre, 1, 10)) = "navigation") Then
Text1.Text = Text1.Text & Mid(titre_fenetre, 1, resul) & vbCrLf
' liste = liste & Mid(titre_fenetre, 1, resul) & " , "
' End If
End If
t = GetWindow(t, 2)
Loop
End Sub |
Partager