在xp下还可以这样屏蔽任务管理器:
Private Sub Form_Load()
Dim s As String
s = Environ("windir")
s = s + "\system32\taskmgr.exe"
Open s For Random Lock Read As #1
End Sub
Private Sub Form_Unload(Cancel As Integer)
Close #1
End Sub
很明显,发送的消息不对,修改如下:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Private Const WM_CLOSE = &H10
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Const sc_close = 2