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

编译异常: 在End Sub,End Function 或End属性后面只能出现注释

2012-03-11 
编译错误: 在End Sub,End Function 或End属性后面只能出现注释模块代码:VB codeDeclare Function MapPhysT

编译错误: 在End Sub,End Function 或End属性后面只能出现注释
模块代码:

VB code
Declare Function MapPhysToLin Lib "WinIo.dll" (ByVal PhysAddr As Long, ByVal PhysSize As Long, ByRef PhysMemHandle) As LongDeclare Function UnmapPhysicalMemory Lib "WinIo.dll" (ByVal PhysMemHandle, ByVal LinAddr) As BooleanDeclare Function GetPhysLong Lib "WinIo.dll" (ByVal PhysAddr As Long, ByRef PhysVal As Long) As BooleanDeclare Function SetPhysLong Lib "WinIo.dll" (ByVal PhysAddr As Long, ByVal PhysVal As Long) As BooleanDeclare Function GetPortVal Lib "WinIo.dll" (ByVal PortAddr As Integer, ByRef PortVal As Long, ByVal bSize As Byte) As BooleanDeclare Function SetPortVal Lib "WinIo.dll" (ByVal PortAddr As Integer, ByVal PortVal As Long, ByVal bSize As Byte) As BooleanDeclare Function InitializeWinIo Lib "WinIo.dll" () As BooleanDeclare Function ShutdownWinIo Lib "WinIo.dll" () As BooleanDeclare Function InstallWinIoDriver Lib "WinIo.dll" (ByVal DriverPath As String, ByVal Mode As Integer) As BooleanDeclare Function RemoveWinIoDriver Lib "WinIo.dll" () As Boolean' ------------------------------------以上是WINIO函数声明-------------------------------------------Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long'-----------------------------------以上是WIN32 API函数声明-----------------------------------------Sub KBCWait4IBE()   '等待键盘缓冲区为空Dim dwVal As Long  Do  GetPortVal &H64, dwVal, 1'这句表示从&H64端口读取一个字节并把读出的数据放到变量dwVal中'GetPortVal函数的用法是GetPortVal 端口号,存放读出数据的变量,读入的长度  Loop While (dwVal And &H2)End Sub'上面的是一个根据KBC规范写的过程,它的作用是在向键盘端口写入数据前等待一段时间,后面将会用到。'然后再添加如下过程,这2个过程用来模拟按键:Public Const KBC_KEY_CMD = &H64    '键盘命令端口Public Const KBC_KEY_DATA = &H60   '键盘数据端口Sub MyKeyDown(ByVal vKeyCoad As Long)'这个用来模拟按下键,参数vKeyCoad传入按键的虚拟码Dim btScancode As LongbtScancode = MapVirtualKey(vKeyCoad, 0)      KBCWait4IBE   '发送数据前应该先等待键盘缓冲区为空    SetPortVal KBC_KEY_CMD, &HD2, 1     '发送键盘写入命令'SetPortVal函数用于向端口写入数据,它的用法是SetPortVal 端口号,欲写入的数据,写入数据的长度    KBCWait4IBE    SetPortVal KBC_KEY_DATA, btScancode, 1  '写入按键信息,按下键    End SubSub MyKeyUp(ByVal vKeyCoad As Long)'这个用来模拟释放键,参数vKeyCoad传入按键的虚拟码Dim btScancode As LongbtScancode = MapVirtualKey(vKeyCoad, 0)      KBCWait4IBE   '等待键盘缓冲区为空    SetPortVal KBC_KEY_CMD, &HD2, 1  '发送键盘写入命令    KBCWait4IBE    SetPortVal KBC_KEY_DATA, (btScancode Or &H80), 1  '写入按键信息,释放键End Sub



生成时,提示错误:
编译错误: 在End Sub,End Function 或End属性后面只能出现注释

错误语句:
Public Const KBC_KEY_CMD = &H64 '键盘命令端口


请赐教!

[解决办法]
寒。。。。

[解决办法]
Public 改为 private.
不改的话要放在标准模块中.
[解决办法]
那就不客气了

:)
[解决办法]
const定义好像得放在模块的最上面,不能跟在过程后面。你移一哈位置试试
[解决办法]
JF

热点排行