BCB的DLL函数参数是一结构体, struct CDRoom{PCHAR dname;
  unsigned char Gain;
  unsigned char Offset;
  unsigned long Exptime;
  unsigned char HBIN;
  unsigned char VBIN;}
在VB里如何定义? 
我在VB里的定义是
  Type CDRoom
    Dname As String 
    Gain As Byte
    offset As Byte
    Exptime As Long
    HBIN As Byte
    VBIN As Byte
 end type但是调用时,提示内存只读错误. 将 Dname改为变体时,提示除数为0的错误. 
请高手指点.Pchar在VB里定义为何类型比较适合.

解决方案 »

  1.   

    delphi编写的DLL吧,pchar类型在bcb中是char*,即字符型指针。
      

  2.   

    是BCB编写的,不是Delphi写的。 
      

  3.   

    看看这本书,也许对你有用:
    http://download.csdn.net/source/3050780
      

  4.   

    pchar 是指针类型,在VB里可以用long
      

  5.   

    Dim BB(7) As Byte
    Dim STr As String
    STr = "AAAAAA" & Chr(0)
    Dim i As Long
    For i = 0 To 6
        BB(i) = Asc(Mid(STr, i + 1, 1))
    Next i
       BB(7) = 0
    With Reg
        '.Devname = StrPtr(STr)
        .Devname = VarPtr(BB(0))
    定义成Long,还是不行,两了数组,和字符串赋值都不行.一样报错.
      

  6.   

    Type CDRoom
      Dname() As Byte  
      Gain As Byte
      offset As Byte
      Exptime As Long
      HBIN As Byte
      VBIN As Byte
    End Type