
Create a fixed-length string of the longest structure size, and pass the address of the string to the API.
Next, create two UDT pointers, and point them to the string, then use the appropriate pointer to manipluate the data.
If you need to initialize a structure member with the structure size first (which some API's need), use the appropriate pointer to set the value.
ie:
Code:
TYPE sometype1 ... END TYPE TYPE sometype2 ... END TYPE ... DIM z AS STRING * <the larger size of sometype1 and sometype2> DIM p1 sometype1 PTR p1 = VARPTR(z) DIM p2 sometype2 PTR p2 = VARPTR(z) CALL someapifunction(BYVAL VARPTR(z),...) IF condition THEN @p1.xxx = ... ELSE @p2.xxx = ... ENDIF
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Leave a comment: