vb代码.帮我看看

来源:百度知道 编辑:UC知道 时间:2024/07/04 22:50:55
Private Sub Command2_Click()
Set objWMIService = CreateObject("winmgmts:{impersonationLevel=Impersonate}!root\cimv2")
Set colProcesslist = objWMIService.ExecQuery("select * from win32_process where name=" & "'wscript.exe'")
For Each objProcess In colProcesslist
objProcess.Terminate
Next
End Sub

Private Sub Command3_Click()
Dim b, speeds, speed, ran
MsgBox ("用法:打开后输入您要刷屏的次数,然后复制一条短语或表情,按确认,转到QQ窗口,就可以了")
b = InputBox("请输入您要刷屏的次数(建议50内):")
speeds = InputBox("请输入您要刷屏的平率(建议5)(提示:越小越快.过快可能导致死机):")
speed = speeds * 100
For i = 1 To b '次数 刷忘会自动停的 建议20 完后再运行
WScript.Sleep speed
WshShell.SendKeys "^v"
WshShell.SendKeys i
WshShell.SendKeys "%s"
Next
MsgBox ("爽吧! ")

End Sub
类型不匹配

哪里有问题哦
就是把下面vbs代码 改成vb的 在按钮上 测试能刷屏在发代码上来... 我不会vb 谢谢

Set WshShell


b = InputBox("请输入您要刷屏的次数(建议50内):")
改为
b = val(InputBox("请输入您要刷屏的次数(建议50内):"))
即可

你哪个位置需要对象??
如果是wsh的话,最好在command3代码前面加上
dim wsh
set wsh=createobject("wscript.shell")
然后把
WScript.Sleep
WShell.Sendkeys
前面全变成wsh
wsh.sleep
wsh.sendkeys
即可

ps看你使用了按钮,那么这段代码应该不是VBS,那样的话
在VB中可以直接使用Sendkeys,去掉前面的wscript.
Sleep的话,直接调用API函数
在程序最前面通用生命的地方加上
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)

然后把Wshell.Sleep直接变成Sleep

==========================================
完整代码

Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()
Dim b&, speeds&, speed&
MsgBox ("用法:打开后输入您要刷屏的次数,然后复制一条短语或表情,按确认,转到QQ窗口,就可以了")
b = Val(InputBox("请输入您要刷屏的次数(建议50内):"))
speeds = Val(InputBox("