RajaramanB
December 18th, 1999, 05:57 AM
1. How to pass an array of structures to a DLL and retrieve back the values ?
2. How to type cast a user-defined type in VB ?
BRR
2. How to type cast a user-defined type in VB ?
BRR
|
Click to See Complete Forum and Search --> : Passing Array of structures to a DLL RajaramanB December 18th, 1999, 05:57 AM 1. How to pass an array of structures to a DLL and retrieve back the values ? 2. How to type cast a user-defined type in VB ? BRR Ravi Kiran December 18th, 1999, 06:46 AM 1. Define the Function with "As Any" Declare Function SomeDllFunc lib "SomeDll"( byref lpUdtAr as Any, byval nc as long) as long Then call the function by passing the first element dim pUdt(9) as UDTSTRUCT lrtn = SomeDllFunc(pUDT(0),10) ' typically the second param telling how many valid elements in the array 2. Type Casting is to be implemented by making another copy actually. You can search the articles secttion to see how exactly it is done. I presume you are refering to Function which return a pointer to a type.. Declare Function UdtReturningFunc Lib "Something" () as long ' get the declaration for RtlMoveMemory ( more famous as CopyMemory fn) . i dont remember off-hand.. something like.. Declare Sub CopyMemory lib "Kernel32" Alias "RtlMoveMemory" (lpDest as Any, lpSource as Any, lBytes as Long) dim pUdt as SOmeUdt dim lpudt as long lpUdt = UdtReturningFunc () CopyMemory pUdt, byval lpUdt, len(pUdt) ' This is actually another copy of the data.. not ' not all that efficient as a Typecast RK codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |