关于调用第三方dll的问题。

欢天xi地 2009-04-13 02:33:53
GetTemplate(int deviceId,unsigned char *pFinger1,unsigned char *pFinger2,unsigned char *pTemplate)
这个是DLL中函数的原型。

我使用VB调用这个函数的代码:
ReDim TemplateData(0 To 511) '对指纹模板变量TemplateData做初始化, 分配512个BYTE
Private Sub Command4_Click()

Dim i As Integer
i = GetTemplate(0, finger1(0), finger2(0), TemplateData(0))
If i = 0 Then
MsgBox "生成特征模板成功!"

Else
MsgBox "错误代码:" + Str(i)
End If

End Sub

请问我如何把templateData 的数据取出来存在数据库啊?
函数原型中,*pTemplate 是个指针。 VB中没有指针的。
...全文
94 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Tiger_Zhao 2009-04-14
  • 打赏
  • 举报
回复
标准dll就是这样调用的。
C函数必须是 stdcall 的,用真实的文件名替换 other.dll,该文件必须在可搜索路径(系统目录、当前目录等)下。
欢天xi地 2009-04-13
  • 打赏
  • 举报
回复
这个方法。是第三方提供呢。用C写的。
我是在VB中调用
Tiger_Zhao 2009-04-13
  • 打赏
  • 举报
回复
重新格式化一下
declare sub GetTemplate Lib "other.dll" _
(byval deviceID as long, _
byref pFinger1 as byte, _
byref pFinger2 as byte, _
byref pTemplate as byte)

ReDim TemplateData(0 To 511) As Byte '不指定类型默认为Variant'
Tiger_Zhao 2009-04-13
  • 打赏
  • 举报
回复
byref 参数等同于指针
declare sub GetTemplate Lib "other.dll" _
(byval deviceID as long
, _
byref pFinger1 as byte, _
byref pFinger2 as byte, _
byref pTemplate as byte)

ReDim TemplateData(0 To 511) As Byte '不指定类型默认为Variant'[/code]

863

社区成员

发帖
与我相关
我的任务
社区描述
VB COM/DCOM/COM+
c++ 技术论坛(原bbs)
社区管理员
  • COM/DCOM/COM+社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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