C语言写了一个DLL,有个函数有结构体(struct)为形参,当VB使用这个函数时 如何对这个以结构体为形参的变量赋值?

解决方案 »

  1.   

    Type yourStruct
     a as long
     b as integer
     c as byte
    End Type
      

  2.   

    需要看看你的struct的C的原型再看看怎么转换到VB
      

  3.   

    如果C结构体是嵌套了多层的结构的结构体 在VB中难道也是Type的多层嵌套吗?我把Type的多层嵌套发给DLL的接口函数,无法通过 提示:DLL调用约定错误。
    例如:C结构体
    struct A
    {
      struct B
       {
         struct C
           {
            ......
            }
         ......
        }
       ......
    }vb的type我也是仿造上面结构体也进行了Type的嵌套 但是在传给接收该结构体的DLL形参时,总是提示DLL调用约定错误,不知道是什么回事?
      

  4.   

    typedef struct 
    {
             uword32 commandLength;
    uword32 commandID;
    uword32  commandStatus;
    uword32  sequenceNo;
    }MESSAGE_HEAD_T;typedef struct
    {
    uword8  sourAddrTon;
    uword8  sourAddrNpi;
    uword8  sourAddrLen;
    uword8  sourAddr[21];
    uword8  destAddrTon;
    uword8  destAddrNpi;
    uword8  destAddrLen;
    }MESSAGE_BODY_T;typedef struct
    {
    MESSAGE_HEAD_T messageHead;
    MESSAGE_BODY_T messageBody;
    }SUBMIT_SM_REQ_T;typedef struct
    {
    MESSAGE_HEAD_T messageHead;
    uword8            messageID;
    } DELIVER_SM_RSP_T;最后作为DLL函数的接口的结构是
    typedef struct
    {
    uword8  opCode;
    union
    {
    SUBMIT_SM_REQ_T   submitSmReq;
    DELIVER_SM_RSP_T   deliverSmRsp;
    }SendMessage;}SEND_MESSAGE_T;