Announcement

Collapse
No announcement yet.

passing UDT's to VB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • passing UDT's to VB


    There's got to be a better way than this to access a pb/dll UDT in VB6:

    in pb:

    Function GetUDTptr ()export as long

    ptr& = varptr(myPbudt)
    function = ptr&

    end function

    in VB:

    Sub GetPbUDT ()

    Ptr&= GetUDTptr() 'call pb
    MoveMemory myVBudt, ptr&, bts 'windows API call
    'bts ist the number of bytes in the udt to read

    end sub


    Thanks all
    Doug
    Doug McDonald
    KD5NWK
    www.redforksoftware.com

  • #2
    What is wrong with this
    Code:
    Type MyType DWord
     Long1     As Long
     String4   As String * 5
     Integer1  As Integer
     Long2     As Long
     String12  As String * 9
    End Type
    PB:
    Function GetUdt(UDT as MyType)Export as long
     ..your code
    End function 
     
    VB:
     Dim P as MyType
     Call GetUdt(P)
    A good advice dealing with VB.
    Plan your UDT. Instead of String*5 use String*8
    Use long instead of integer.
    Never have two Integers after eachother in the UDT
    Type MyType DWord
    A as integer
    B as integer
    C as string *5
    End type

    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se



    [This message has been edited by Fred Oxenby (edited February 11, 2000).]
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Comment


    • #3
      Fred,


      Well I feel about an inch high.....I've over looked the obvious....Maybe a mack truck will hit me and wake me up.

      Thank you it works perfectly. Don't know what I was thinking

      Doug

      ------------------
      Doug McDonald
      KD5NWK
      www.redforksoftware.com

      Comment

      Working...
      X