Dim temp As String
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
Dim sSave As String, Ret As Long
Ret = GetWindowTextLength(hwnd)
sSave = Space(Ret)
GetWindowText hwnd, sSave, Ret + 1
If sSave <> vbNullString And IsWindowVisible(hwnd) Then temp = temp & sSave & vbCrLf
'continue enumeration
EnumWindowsProc = True
End Function
Public Function App_Ouverte()
temp = ""
EnumWindows AddressOf EnumWindowsProc, ByVal 0&
App_Ouverte = temp
End Function
'Dans la form
Dim ouverte() As String
Private Sub Form_Load()
ouverte = Split(App_Ouverte, vbCrLf)
End Sub
Private Sub Timer1_Timer()
'mise a jour de list1 selon la liste de depart des appli ouverte
List1.Clear
Dim temp() As String
Erase temp
temp = Split(App_Ouverte, vbCrLf)
Dim Existe As Boolean
Existe = False
For i = 0 To UBound(temp)
For a = 0 To UBound(ouverte)
If temp(i) ouverte(a) Then Existe True: Exit For
Next a
If Not Existe And temp(i) <> Me.Caption Then List1.AddItem temp(i)
Existe = False
Next i
ce bout de prog affiche les processus lancé en temps réel grace a un timer (un peu comme le gestionnaire des taches), il ne me reste plus qu'a détecter le nom de mon application dans list1 si elle n'est pas présente alors je la démarre, je pense y arriver seul MERCI