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

关于API函数别名的有关问题

2012-01-14 
关于API函数别名的问题在Modules中声明了API函数:DeclareFunctionReadFileLibkernel32 AliasReadFileCO

关于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名称有误

热点排行