Voici un code que j'ai trouvé sur ce site et que j'ai remis à ma sauce :
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Public Function TaskExists(ByVal strCheckTask As String) As Boolean
Dim CurrWnd As Long
Dim Length As Long
Dim TaskName As String
TaskExists = False
CurrWnd = GetActiveWindow()
Do While (CurrWnd <> 0)
Length = GetWindowTextLength(CurrWnd)
TaskName = Space(Length + 1)
Length = GetWindowText(CurrWnd, TaskName, Length + 1)
TaskName = Left(TaskName, Len(TaskName) - 1)
If (Length > 0) Then
If InStr(1, TaskName, strCheckTask, vbTextCompare) <> 0 Then
TaskExists = True
Exit Do
End If
End If CurrWnd GetWindow(CurrWnd, 2) '\2 next window handle
Loop
End Function
Cette fonction permet de savoir si mon l'application est déjà démarrer ou pas (via API)
Le prob est que sous environement VB ça marche nickel, ms qd je créé l'exécutable, ça marche plus, POURQUOIIII???
Tu sais, c la magie de vb ca .. j'avais fait un exe dont le source est ici qui cherchait récursivement les fichier .. et ben, en développement la recherche à partir d'un lecteur racine fonctionnait niquel, mais dès que je le lançait en exe fiou! le prog disparaissait sans meme générer une erreur... :question) :question) :question)