Results 1 to 2 of 2

Thread: returning c structure to a VB application

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    I think you can pass it ByRef as an argument.
    Hope this helps

    Crazy D

  2. #2
    New Member
    Join Date
    Aug 2000
    Posts
    1
    I'm not trying to pass the structure to the dll. I'm try to return the structure from the DLL to VB. I declare the c++ function in the DLL to have a return value of CODES * (which is a pointer to my c++ structure). In VB I declare the return value as CODES (which is a UDT with the same varibles defined as the c++ structure). However, when I use the variables they have bogus information. Code is as follows:

    C++

    typedef struct CODES
    {

    int sH;
    int rC;

    } CODES;


    CODES * _stdcall fnCpp(char * dbF, int aM, char * sN, int cT, char * aN)

    VB declaration

    Public Type CODES

    intSH As Integer
    intRC As Integer

    End Type

    Public Declare Function fnCpp Lib "C:\cpp\cppfile.dll" _
    (ByRef strDb As String, ByVal intAM As Integer, _
    ByRef strSN As String, ByVal intCT As Integer, _
    ByRef strAN As String) As CODES

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width