vb自杀代码(转载)
vb自杀代码(转载)
2008年06月12日 星期四 上午 08:26
感觉这样效果不错,通用性高点,2000和XP都可以运行
(注:在IDE环境下运行调试本程序,请慎重~~)
代码:
窗体:
Private Sub Form_Load()
Call KillMe
End Sub
模块中:
'ModKillMe.basPrivate Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As LongPrivate Declare Function GetCurrentProcessId Lib "kernel32" () As Long '获取自己的PIDPrivate Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)'BY zhouweizhu@126.com'http://www.imcode.cnPublic Sub KillMe()Dim MyFilename As StringDim tmp As String * 255Dim l As Integerl = GetModuleFileName(0, tmp, 255)MyFilename = Mid(tmp, 1, l)'taskkill速度快' Shell "cmd /c taskkill /f /pid " & GetCurrentProcessId & " && del """ & MyFilename & """", vbHide'NTSD结束进程速度慢,貌似试一次还不够' Shell "cmd /c ntsd -c q -p " & GetCurrentProcessId & " && del """ & MyFilename & """", vbHide'用PING来延时,自己退出等着被删不错Shell "cmd /c ping 127.0.0.1 -n 1 && del """ & MyFilename & """", vbHide: ExitProcess (0)End Sub
TA的首页

