合肥东芯通信 股票:VB高手兼热血江湖玩家们请来!!本人求VB代码!

来源:百度文库 编辑:高考问答 时间:2024/04/26 09:11:05
本人试图自制热血江湖群医用补血挂,不知道“按键”的代码是什么。有人告诉我是
Private Sub Timer1_Timer()
SendKeys vbKeyF10, True '相当于按了一下F10键
End sub
结果在输入框里出来大段的F10的ACSCII代码121121121121121……
下面是原问题:

先摆上2个cammand,1个timer,1个label

Private Sub Command2_Click()
unlode Me
End Sub

Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Form load

timer1.interval=100,enabled=false

command1.caption="开始"

command2.caption="关闭"

label1.caption="使用方法:单击开始,此后每秒自动按F10键10次。"
End Sub

Private Sub Timer1_Timer()
????????
End sub
我不会表达那个“按键”的命令。
能给我能运行的代码的朋友,我会追赠积分50!!!!!谢谢!

Private Sub Timer1_Timer()

Call keybd_event(Asc("O"), MapVirtualKey(Asc(F10), 0), 0, 0)
End Sub

模块:module1
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long
可以试试看,98下似乎不能通过,xp下可以,注:
1。SendKeys (有一定的局限性)
2。keybd_event 应该是没有问题
3。SendMessage 我觉得这种方式最好吧。