日期:2012-12-12  浏览次数:20459 次

我今天用了www.cn90.net原创的一个刷QQ等级的工具。感觉这样软件它的编写很无聊,也不难,因此我就试着用VB也编写一个吧!

========================================================
Option Explicit
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function GetTickCount Lib "kernel32" () As Long
Const PROCESS_TERMINATE = 1
Dim ProID As Long
Dim strpath As String
Dim mm

Private Sub Command1_Click()
Command1.Enabled = False
Command2.Enabled = True
mm = Val(Text2.Text) * 1000
strpath = Text1.Text
ProID = Shell(strpath, vbNormalFocus)
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
End Sub

Private Sub Form_Load()
Command2.Enabled = False
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
Dim hProcess As Long
Dim i
i = GetTickCount()
Do Until GetTickCount() > i + mm
DoEvents
Loop
hProcess = OpenProcess(PROCESS_TERMINATE, False, ProID)
TerminateProcess hProcess, 1
CloseHandle hProcess
ProID = Shell(strpath, vbNormalFocus)
End Sub

========================================================

cn90的刷等级的工具是用bcb编写的,我这个用VB编写的。两个软件虽然用法不太一样,但是功能差不多啦!