Results 1 to 2 of 2

Thread: [2005] convert a C++ structure to VB 2005 code

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    14

    [2005] convert a C++ structure to VB 2005 code

    Hi,

    how can I translate this C++ code in VB code?
    I need the function to read informations from a PROFIBUS card out. The card is in my PC.

    definition of the code:
    Code:
    short DevGetBoardInfo (unsigned short usDevNumber,
                            unsigned short usSize,
                            void *pvData);
    Data structure:
    Code:
    typedef struct tagBOARD_INFO{
    unsigned char abDriverVersion[16];
    struct {
    unsigned short usBoardNumber; 
    unsigned short usAvailable; 
    unsigned long ulPhysicalAddress; 
    unsigned short usIrqNumber; 
    } tBoard [MAX_DEV_BOARDS];
    } BOARD_INFO;
    How can I call the function in my program?

    Thanks for your help!!

  2. #2
    Fanatic Member
    Join Date
    Jan 2006
    Posts
    710

    Re: [2005] convert a C++ structure to VB 2005 code

    Code:
    Public Class GlobalMembers
    
    	Public Shared Function DevGetBoardInfo (ByVal usDevNumber As UShort, ByVal usSize As UShort, ByVal pvData As IntPtr) As Short
    	End Function
    End Class
    
    Public Class tagBOARD_INFO
    	Public abDriverVersion(15) As Byte
    'C++ to VB CONVERTER NOTE: Classes must be named in VB, so the following class has been named AnonymousClass:
    	Public Class AnonymousClass
    		Public usBoardNumber As UShort
    		Public usAvailable As UShort
    		Public ulPhysicalAddress As UInteger
    		Public usIrqNumber As UShort
    	End Class
    	Public tBoard(MAX_DEV_BOARDS - 1) As AnonymousClass
    End Class
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com

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