欲调用此函数
BOOL WINAPI GX_GetMonitorData(unsigned short* ChannelNo,unsigned char* IsFinish, unsigned char* pMonitorData,unsigned short*DataLen,unsigned short Len);
vb如何调用c++语言编写的dll函数?
答案:2 悬赏:30 手机版
解决时间 2021-05-10 21:37
- 提问者网友:niaiwoma
- 2021-05-10 16:48
最佳答案
- 五星知识达人网友:一叶十三刺
- 2021-05-10 18:15
在模块中加入
Declare Function GX_GetMonitorData Lib "*.dll" (ByRef ChannelNo As Long, ByRef IsFinish As Long, ByRef pMonitorData As Long, ByRef DataLen As Long, ByVal Lens As Long) As Boolean
Declare Function GX_GetMonitorData Lib "*.dll" (ByRef ChannelNo As Long, ByRef IsFinish As Long, ByRef pMonitorData As Long, ByRef DataLen As Long, ByVal Lens As Long) As Boolean
全部回答
- 1楼网友:蓝房子
- 2021-05-10 19:34
1.在工程-引用中将asdfg.dll引用过来
2.dim AAA as asdfg 'asdfg是类模块的名称
Private Sub Form_Load()
dim x
Set AAA = New asdfg
x = AAA.zxc(参数1,参数2)'参数1,2自己写
End Sub
建议你了解一下下面dll的制作方法,理解就更透彻了。下面内容来自百度。
1.新建一个ActiveX Dll,工程名字为vbmytestdll,类模块名字为mytestdll
2.类模块内容只有一个函数,主要返回DLL的HELLO WORLD
Public Function dlltest1() As String
dlltest1 = "HELLO WORLD"
End Function
3.保存,生成DLL,名字为
vbmytestdll.dll
4.新建一个EXE工程,在菜单: 工程---引用---浏览里找到vbmytestdll.dll,把它引用进来
5.EXE工程代码如下:
Option Explicit
Dim testdll As mytestdll'类模块名字
Private Sub Form_Load()
Set testdll = New mytestdll 'DLL的一个新实例
Me.Caption = testdll.dlltest1 '我的标题=返回DLL的HELLO WORLD
End Sub
OK,编译成EXE即可看到效果.
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯