高分求教高手,Dll文件的使用

haj77 2003-05-13 02:53:50
由于我对VB刚开始认识,现在有C++Build写的一个DLL文件,里面有两个函数:
extern "C" __declspec(dllimport) int __stdcall MF_Request(int DeviceAddress, unsigned char inf_mode, unsigned char *buffer);
extern "C" __declspec(dllimport) int __stdcall MF_Anticoll(int DeviceAddress,unsigned char *snr,unsigned char &status);

1.在Delphi上定义为:
function MF_Request(addr:integer;mode:byte;atq:pchar):integer;stdcall;external 'CVAPIV01.dll'
function MF_Anticoll(addr:integer;snr:pchar;cstatus:pchar):integer;stdcall;external 'CVAPIV01.dll';
使用为:
var ATQ:String;
SetLength(ATQ,2);
IF MF_Request(0,1,Pchar(ATQ))=0 then
Showmessage(调用成功);
上面是OK的。
2.请问在VB中如何定义调用它,需要注册那么麻烦吗?我下面写的3个参数对吗?
Private Declare Function MF_Request Lib "CVAPIV01.dll" (ByVal DeviceAddress As Long, ByVal mode As Long, ByVal buffer As String)
As Integer
Private Declare Function MF_Anticoll Lib "CVAPIV01.dll" (ByVal DeviceAddress As Long, ByVal snr As string, ByVal buffer As String)
As Integer
3.如果不对如何定义以及在语句中的使用?
...全文
78 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧