!急!!调用DLL时的传地址的问题!

davidwx 2002-04-09 01:04:35
DLL调用声明如下
Public Declare Function ExecOP Lib "dzdll.dll" _
(ByRef nCmd As Integer, ByVal nComlen As Integer, ByVal strCommand _
As String, ByRef strRetData() As Byte) As Integer

调用ExecOP函数如下
Private Function Exec(ByVal nCmd As Integer, ByVal nComlen As Integer, ByVal strData As String)
Dim nInt(0) As Integer
Dim nResult As Integer
Dim strRD() As Byte

nInt(0) = nCmd
ReDim strRD(1024)
nResult = ExecOP(nInt(0), nComlen, strData, (strRD))
MsgBox nResult
End Function

一运行,没有任何提示,VB就死!请指点!! 一定给分!

...全文
64 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
davidwx 2002-04-09
  • 打赏
  • 举报
回复
问题解决,采用是technofantasy(www.applevb.com) 的第二种方法!
多谢三位!!!
ltpao 2002-04-09
  • 打赏
  • 举报
回复
回复人: load(不是东西) ( ) 信誉:100 2002-04-09 14:19:00 得分:0


楼上应该可以了,若还不行,看看第一个参数,改为声明:

Public Declare Function ExecOP Lib "dzdll.dll" _
(Byval nCmd As Integer, ByVal nComlen As Integer, ByVal strCommand _
As String, ByRef strRetData As Byte) As Integer

调用:nResult = ExecOP(nInt(0), nComlen, strData, (strRD(0)))


楼上应该可以了,若还不行:

调用:nResult = ExecOP(nInt(0), nComlen, strData, strRD(0))

load 2002-04-09
  • 打赏
  • 举报
回复
楼上应该可以了,若还不行,看看第一个参数,改为声明:

Public Declare Function ExecOP Lib "dzdll.dll" _
(Byval nCmd As Integer, ByVal nComlen As Integer, ByVal strCommand _
As String, ByRef strRetData As Byte) As Integer

调用:nResult = ExecOP(nInt(0), nComlen, strData, (strRD(0)))


load 2002-04-09
  • 打赏
  • 举报
回复
同意楼上,要还不行就要检查其它参数了,strRetData参数的使用肯定是对的。
TechnoFantasy 2002-04-09
  • 打赏
  • 举报
回复
试一下这样定义:
Public Declare Function ExecOP Lib "dzdll.dll" _
(ByRef nCmd As Integer, ByVal nComlen As Integer, ByVal strCommand _
As String, ByVal strRetData As String) As Integer

或者

Public Declare Function ExecOP Lib "dzdll.dll" _
(ByRef nCmd As Integer, ByVal nComlen As Integer, ByVal strCommand _
As String, ByRef strRetData As Byte) As Integer

调用的时候将Byte数组中的第一个字节传递过去:
nResult = ExecOP(nInt(0), nComlen, strData, (strRD(0)))
davidwx 2002-04-09
  • 打赏
  • 举报
回复
我是目的是传给DLL一个空间(ExecOP中的第四个参数),DLL会放一些值在这个空间内,我要能够读取这个值!!

7,759

社区成员

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

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