Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parameters by reference to an activeX control
Message
From
29/09/2002 17:03:25
 
 
To
29/09/2002 14:21:17
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00704244
Message ID:
00705702
Views:
15
Hello Lucas,

you may try this:



LOCAL lcIntBin, liYourInt
liYourInt = 100
lcIntBin = NumToSHORT(liYourInt)
activeX.Method(@lcIntBin)
liYourInt = SHORTToNum(lcIntBin)

&& these functions are out of clsheap.prg from Ed Rauh (you can get the
&& complete library in the download section)
FUNCTION NumToSHORT
* Creates a C SHORT as a string from a number
* Parameters: tnNum (R) Number to convert
LPARAMETERS tnNum
*
* b0, b1, x hold small ints
*
LOCAL b0,b1,x
IF tnNum>=0
x=INT(tnNum)
b1=INT(x/256)
b0=MOD(x,256)
ELSE
x=INT(-tnNum)
b1=255-INT(x/256)
b0=256-MOD(x,256)
IF b0=256
b0=0
b1=b1+1
ENDIF
ENDIF
RETURN CHR(b0)+CHR(b1)
ENDFUNC

FUNCTION SHORTToNum
* Converts a 16 bit signed integer in a structure to a VFP Numeric
LPARAMETER tcInt
LOCAL b0,b1,nRetVal
b0=asc(tcInt)
b1=asc(subs(tcInt,2,1))
if b1<128
*
* positive - do a straight conversion
*
nRetVal=b1 * 256 + b0
else
*
* negative value - take twos complement and negate
*
b1=255-b1
b0=256-b0
nRetVal= -( (b1 * 256) + b0)
endif
return nRetVal
ENDFUNC



Regards

Christian
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform