首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

求教,小弟我不懂编程

2012-02-22 
求教,我不懂编程学过VB,但是那时上课是在泡妹妹,真是红颜祸水啊。正题:我在学VB写外挂但很多不懂,下面是我

求教,我不懂编程
学过VB,但是那时上课是在泡妹妹,真是红颜祸水啊。正题:我在学VB写外挂但很多不懂,下面是我抄来的,查了很多资料但运行报错。
新建模块,弄进去
Public Declare Function MapPhysToLin Lib "WinIo.dll" (ByVal PhysAddr As Long, ByVal PhysSize As Long, ByRef PhysMemHandle) As Long
Public Declare Function UnmapPhysicalMemory Lib "WinIo.dll" (ByVal PhysMemHandle, ByVal LinAddr) As Boolean
Public Declare Function GetPhysLong Lib "WinIo.dll" (ByVal PhysAddr As Long, ByRef PhysVal As Long) As Boolean
Public Declare Function SetPhysLong Lib "WinIo.dll" (ByVal PhysAddr As Long, ByVal PhysVal As Long) As Boolean
Public Declare Function GetPortVal Lib "WinIo.dll" (ByVal PortAddr As Integer, ByRef PortVal As Long, ByVal bSize As Byte) As Boolean
Public Declare Function SetPortVal Lib "WinIo.dll" (ByVal PortAddr As Integer, ByVal PortVal As Long, ByVal bSize As Byte) As Boolean
Public Declare Function InitializeWinIo Lib "WinIo.dll" () As Boolean
Public Declare Function ShutdownWinIo Lib "WinIo.dll" () As Boolean
Public Declare Function InstallWinIoDriver Lib "WinIo.dll" (ByVal DriverPath As String, ByVal Mode As Integer) As Boolean
Public Declare Function RemoveWinIoDriver Lib "WinIo.dll" () As Boolean
Public Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long
Public Const KBC_KEY_CMD = &H64
Public Const KBC_KEY_DATA = &H60

下面这些我就直接弄在form窗口里面了。那句放那我也不知道,复制的。

Public Sub KBCWait4IBE() '等待键盘缓冲区为空
Dim dwVal As Long
  Do
  GetPortVal &H64, dwVal, 1
'这句表示从&H64端口读取一个字节并把读出的数据放到变量dwVal中
'GetPortVal函数的用法是GetPortVal 端口号,存放读出数据的变量,读入的长度
  Loop While (dwVal And &H2)
End Sub
Public Sub MyKeyDown(ByVal vKeyCoad As Long)
'这个用来模拟按下键,参数vKeyCoad传入按键的虚拟码
Dim btScancode As Long
btScancode = MapVirtualKey(vKeyCoad, 0)
  
  KBCWait4IBE '发送数据前应该先等待键盘缓冲区为空
  SetPortVal KBC_KEY_CMD, &HD2, 1 '发送键盘写入命令
'SetPortVal函数用于向端口写入数据,它的用法是SetPortVal 端口号,欲写入的数据,写入数据的长度
  KBCWait4IBE
  SetPortVal KBC_KEY_DATA, btScancode, 1 '写入按键信息,按下键
   
End Sub
Public Sub MyKeyUp(ByVal vKeyCoad As Long)
'这个用来模拟释放键,参数vKeyCoad传入按键的虚拟码
Dim btScancode As Long
btScancode = MapVirtualKey(vKeyCoad, 0)
  
  KBCWait4IBE '等待键盘缓冲区为空
  SetPortVal KBC_KEY_CMD, &HD2, 1 '发送键盘写入命令
  KBCWait4IBE
  SetPortVal KBC_KEY_DATA, (btScancode Or &H80), 1 '写入按键信息,释放键

End Sub
窗体代码:
Private Sub Form_Load()
If InitializeWinIo = False Then
  MsgBox "驱动程序加载失败!"
  Unload Me
End If
Timer1.Interval = 3000
Timer1.Enabled = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
ShutdownWinIo '程序结束时记得用ShutdownWinIo函数卸载驱动程序
End Sub

Private Sub Timer1_Timer()
MyKeyDown VK_A
MyKeyUp VK_A '全部键的常数定义在模块中了,为了字数限制没有粘上来
End Sub

我把winio.dll winio.sys winio.vxd这3个放在目录下了,但是报错,加载不了驱动,还报了一个:Public Sub MyKeyUp(ByVal vKeyCoad As Long)这个只能什么注释哦。搞求不懂啊。

不清楚没关系,那个推荐一下VB驱动级模拟按键的教程或者什么地址学习什么的!


[解决办法]
找些资料猛读一下
[解决办法]
不懂,好像现在是玩wdm
[解决办法]
从简单的学起比较好..
[解决办法]
兄弟从基础从新学吧,不然举步维艰、寸步难行,辛苦啊
[解决办法]
别跑这么快!
------解决方案--------------------


http://www.m5home.com/bbs/thread-3666-1-1.html
[解决办法]
刘欢都说了《从头再来》.
[解决办法]
同情并支持一下
[解决办法]
友情围观………………
[解决办法]
改用AutoHotKey软件做外挂

热点排行