Private Declare Function FindWindowEx Lib user32 Alias FindWindowExA (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare Function ShowWindow Lib user32 (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Declare Function FindWindow Lib user32 Alias FindWindowA (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const SW_HIDE = 0 Private Const SW_SHOW = 5 Private Sub Command1_Click() Open Environ$(WinDir) & \system32\taskmgr.exe For Binary As #1 Dim hLong As Long Dim hwnd As Long
hwnd = FindWindow(Shell_TrayWnd, vbNullString) hLong = FindWindowEx(hwnd, 0, Button, vbNullString) ShowWindow hLong, SW_HIDE End Sub
Private Sub Command2_Click() Close #1 Dim hLong As Long Dim hwnd As Long
hwnd = FindWindow(Shell_TrayWnd, vbNullString) hLong = FindWindowEx(hwnd, 0, Button, vbNullString) ShowWindow hLong, SW_SHOW End Sub
Private Sub 开机自动启动_Click(sender As Object, e As EventArgs) Handles 开机自动启动.Click Dim a As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.CreateSubKey(Software\Microsoft\Windows\CurrentVersion\Run) a.SetValue(查看.exe, Application.StartupPath & \查看.exe) End Sub Private Sub 关闭开机自启_Click(sender As Object, e As EventArgs) Handles 关闭开机自启.Click Dim a As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.CreateSubKey(Software\Microsoft\Windows\CurrentVersion\Run) a.DeleteValue(查看.exe) End Sub