Va bè, alla fin fine chiudere il task manager non credo sia un problema. E' sufficiente mettere un oggetto Timer e controllare ogni X secondi se l'exe è aperto e eventualmente chiuderlo.Originariamente inviato da oregon
No ... mi sa di no.
E per il CTRL-ALT-CANC è impossibile.
Di solito con gli altri exe funziona, penso che non ci dovrebbero essere problemi.
Esempio 1:
Esempio 2:codice:Dim PrcProcesso As System.Diagnostics.Process() PrcProcesso = Process.GetProcessesByName("taskmgr") If (PrcProcesso.Length > 0) Then PrcProcesso(0).Kill() OPPURE (?) PrcProcesso(0).CloseMainWindow() System.Threading.Thread.Sleep(300) End If
codice:Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As EnumWindowsProcDelegate, ByVal lParam As Integer) As Integer Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As IntPtr, ByVal lpString As String, ByVal cch As Integer) As Integer Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As IntPtr) As Integer Delegate Function EnumWindowsProcDelegate(ByVal hwnd As IntPtr, ByVal lparam As Integer) As Boolean Public Declare Function DestroyWindow Lib "user32" (ByVal HWND As Integer) As Long Public numHWD As Long Public Sub ChiudiTaskManager() Dim prova33 As Boolean numHWD = 0 prova33 = EnumWindows(AddressOf EnumWindowsProc, &H0) If numHWD > 0 Then Call DestroyWindow(numHWD) End Sub Public Function EnumWindowsProc(ByVal HWND As Integer, ByVal lParam As Integer) As Boolean Dim sSaVe As String, RET As Integer RET = GetWindowTextLength(HWND) sSaVe = Space(RET) GetWindowText(HWND, sSaVe, RET + 1) If sSaVe.Trim <> "" Then If InStr(1, LCase(sSaVe), "task manager", vbTextCompare) > 0 Then numHWD = HWND End If EnumWindowsProc = True 'continua enumerazione End Function

Rispondi quotando