Runs an executable program and returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero.
Private Sub stopexe(sTitle As String) 'sTitle doit etre le lpWindowName ce n'est pas le chemin comme le parametre du shell Dim iHwnd As Integer Dim ihTask As Integer Dim iReturn As Integer iHwnd = FindWindow(0&, sTitle) iReturn = PostMessage(iHwnd, WM_QUIT, 0, 0&) MsgBox "Notepad has been Closed Down" End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function PostMessage Lib "User" (ByVal hWnd _ As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _ lParam As Any) As Integer Private Const WM_QUIT = &H12