per chiudere unapplicazione attiva fa così
per esguire killcodice:Const WM_CLOSE = &H10 Declare Function FindWindowA Lib "user32" _ (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Integer Declare Function SendMessageA Lib "user32" _ (ByVal hWnd As Integer, ByVal wMsg As Integer, _ ByVal wParam As Integer, lParam As Any) As Long Function Kill(hWnd&) Dim Res& ' Ask it politely to close Res = SendMessageA(hWnd, WM_CLOSE, 0, 0) ' Kill it (just in case) Res = SendMessageA(hWnd, WM_DESTROY, 0, 0) End Function
codice:Dim hWnd& ' window handle hWnd = FindWindowA(vbNullString, [NomeApp]) Kill (hWnd)

Rispondi quotando