关于API函数别名的有关问题
关于API函数别名的问题
在Modules中声明了API函数:
Declare Function ReadFile Lib "kernel32 " Alias "ReadFileCOM " (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long
在Form窗体中如下调用时
Dim retval As Long
retval = ReadFileCOM(ComNum, ByVal Buffer, 255, RetBytes, 0)
出错,Sub Or Function not denied!请问是什么原因啊?
------解决方案--------------------
Declare Function ReadFileCOM Lib "kernel32 " Alias "ReadFile " (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long
------解决方案--------------------
同上,顺序反了。。。
------解决方案--------------------
去掉Alias "ReadFileCOM "
只用readfile
------解决方案--------------------
别名才是真名,不要搞反了,如果说还是找不到,恐怕你的api名称有误
在Modules中声明了API函数:
Declare Function ReadFile Lib "kernel32 " Alias "ReadFileCOM " (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long
在Form窗体中如下调用时
Dim retval As Long
retval = ReadFileCOM(ComNum, ByVal Buffer, 255, RetBytes, 0)
出错,Sub Or Function not denied!请问是什么原因啊?
------解决方案--------------------
Declare Function ReadFileCOM Lib "kernel32 " Alias "ReadFile " (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long
------解决方案--------------------
同上,顺序反了。。。
------解决方案--------------------
去掉Alias "ReadFileCOM "
只用readfile
------解决方案--------------------
别名才是真名,不要搞反了,如果说还是找不到,恐怕你的api名称有误