Welcome! Log In Create A New Profile


Using TRANSFER with API calls

Posted by Patrice Terrier 
Patrice Terrier
Using TRANSFER with API calls
June 24, 2009 01:18PM
Useful TIP

You probably know that the WL API keyword returns "only" a long integer whatever the real value returned by the underlaying api call.

What to do, if the returned value is a pointer to a structure or indeed a real value?

Then the WL Transfer comes to rescue, here is an example showing you how to turn the Long integer (4-byte int) into a Single 4-byte real.

// Example based on the GDImage encapsulation
FUNCTION ZI_GetZoomValue(LOCAL hWnd is int)
nRet is int = ZI_GetProperty(hWnd, ZI_ZoomFactor)
rValue is 4-byte real       // <----------
Transfer(&rValue, &nRet, 4) // <----------
IF rValue < 0.001 THEN rValue = 1

Your Email:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.