www.pudn.com > Taskscontroler.rar > Form1.frm
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "关闭程序"
ClientHeight = 3360
ClientLeft = 45
ClientTop = 330
ClientWidth = 4605
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3360
ScaleWidth = 4605
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
Height = 495
Left = 6120
Picture = "Form1.frx":000C
ScaleHeight = 435
ScaleWidth = 1155
TabIndex = 5
Top = 1680
Visible = 0 'False
Width = 1215
End
Begin VB.Timer Timer1
Interval = 200
Left = 5760
Top = 360
End
Begin VB.ListBox List1
Height = 1860
ItemData = "Form1.frx":044E
Left = 180
List = "Form1.frx":0450
TabIndex = 4
Top = 120
Width = 4215
End
Begin VB.CommandButton CmdCancel
Caption = "取消"
Height = 320
Left = 3120
TabIndex = 3
Top = 2880
Width = 1335
End
Begin VB.CommandButton CmdShutDown
Caption = "关机(&S)"
Height = 320
Left = 1680
TabIndex = 2
Top = 2880
Width = 1335
End
Begin VB.CommandButton CmdEndprogress
Caption = "结束任务(&E)"
Height = 320
Left = 240
TabIndex = 1
Top = 2880
Width = 1335
End
Begin VB.CheckBox Check1
Caption = "是否包括后台程序"
Height = 255
Left = 4920
TabIndex = 0
Top = 1680
Value = 1 'Checked
Width = 1815
End
Begin VB.Label Label1
Caption = "警告:再次按下 CTRL+ALT+DEL 将重新启动计算机。这样会丢失所有正在运行的程序中没有保存的信息。"
Height = 495
Left = 240
TabIndex = 6
Top = 2160
Width = 4215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Err As Long
Private Sub Check1_Click()
FindAllApps List1, Check1.Value
End Sub
Private Sub CmdCancel_Click()
CloseWindow (Form1.hwnd)
End Sub
Private Sub CmdEndprogress_Click()
SendMessage List1.ItemData(List1.ListIndex), WM_CLOSE, 0, 0
FindAllApps List1, True
End Sub
Private Sub CmdShutDown_Click()
ExitWindowsEx EWX_REBOOT, 0
End Sub
Private Sub Form_Load()
On Local Error Resume Next
If (Icon_Add(Form2.hwnd, Picture1.Picture)) Then
'将DialogProc函数设置为Form2的窗口处理函数并且保存原来窗口处理函数句柄
lproc = SetWindowLong(Form2.hwnd, GWL_WNDPROC, AddressOf DialogProc)
End If
Dim pOld As Boolean
SystemParametersInfoByRef SPI_SCREENSAVERRUNNING, True, pOld, 0
MakeMeService
Dim hThread As Long, hProcess As Long
'retrieve the current thread and process
hThread = GetCurrentThread
hProcess = GetCurrentProcess
SetThreadPriority hThread, THREAD_PRIORITY_HIGHEST
SetPriorityClass hProcess, HIGHEST_PRIORITY_CLASS
Err = SetWindowPos(Form1.hwnd, -1, 0, 0, 0, 0, 3)
Dim hSysMenu As Long, nCnt As Long
' Get handle to our form's system menu
' (Restore, Maximize, Move, close etc.)
hSysMenu = GetSystemMenu(Me.hwnd, False)
If hSysMenu Then
' Get System menu's menu count
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then
' Menu count is based on 0 (0, 1, 2, 3...)
RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE ' Remove the seperator
DrawMenuBar Me.hwnd
' Force caption bar's refresh. Disabling X button
End If
End If
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
Dim l As Long
Dim wHotkey As Long
'设置热键为Ctrl+Alt+del
wHotkey = (HOTKEYF_ALT Or HOTKEYF_CONTROL) * 256 + vbKeyDelete
l = SendMessage(Me.hwnd, WM_SETHOTKEY, wHotkey, 0)
FindAllApps List1, True
CloseWindow (Form1.hwnd)
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Local Error Resume Next
Dim pOld As Boolean
SystemParametersInfoByRef SPI_SCREENSAVERRUNNING, False, pOld, 0
Icon_Del (ano.hwnd)
Unload Form2
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnMakeMeService
End Sub
Private Sub List1_DblClick()
CmdEndprogress_Click
End Sub
Private Sub Timer1_Timer()
If IsIconic(Form1.hwnd) Then
Form1.Visible = False
Else
Form1.Visible = True
End If
End Sub