KillApp

cs_TS1 Messages postés 29 Date d'inscription lundi 16 janvier 2006 Statut Membre Dernière intervention 23 janvier 2007 - 25 janv. 2006 à 10:42
cs_eldim Messages postés 956 Date d'inscription lundi 30 mai 2005 Statut Membre Dernière intervention 21 août 2014 - 25 janv. 2006 à 15:16
Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, _
lpdwprocessid As Long) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long) As Long
Private Const WM_CLOSE = &H10
Private Const GWL_STYLE = (-16)
Private Const WS_SYSMENU = &H80000


Private Function CloseWindow(ByVal hwnd As Long, ByVal hInstance As Long) As Long


Dim idproc As Long


idproc = 0


'reçoit dans idproc l'id du processus lié à cette fenêtre
GetWindowThreadProcessId hwnd, idprocIf (idproc hInstance) And ((GetWindowLong(hwnd, GWL_STYLE) And WS_SYSMENU) WS_SYSMENU) Then
PostMessage hwnd, WM_CLOSE, 0, 0
End If


'obligatoire pour qu'EnumWindows continue l'énumération
CloseWindow = True


End Function


Public Sub KillApp(hInstance As Long)


EnumWindows AddressOf CloseWindow, hInstance


End Sub
__________________________________________________________

Alors voila j'ai trouver ce code pour fermer mon application avec la fonction shell. Je voudrais killé l'application "ntvdm.exe" mais je ne sais pas ou la mettre dans ces lignes de codes. Merci, en esperant mettre bien exprimé.

1 réponse

cs_eldim Messages postés 956 Date d'inscription lundi 30 mai 2005 Statut Membre Dernière intervention 21 août 2014 1
25 janv. 2006 à 15:16
Bonjour,
Arrete de t'emmerder avec ces API si tu ne les comprends
Y a un utilitaire windows qui s'appelle "tskill" et qui fonctionne très bien
0
Rejoignez-nous