Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VB type statement using declare statament
Message
 
 
To
11/04/1998 17:42:58
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00091341
Message ID:
00091358
Views:
20
Alexander

>* ctobin( left( lcParam, 4)) as istatus

The ctobin and bintoc do not create values that are compatible with the normal binary representations of integers.

Here's the functions I use:
* ConvertAPI.prg 08-Oct-97 

* these functions convert to/from internal binary storage

function ToWord( pnNumber )
nMSB = int( pnNumber / 256 )  && most significant byte
nLSB = pnNumber % 256  && least significant byte
return chr( nLSB ) + chr( nMSB )

function ToLong( pnNumber )
nMSW = int( pnNumber / 65536 )  && most significant word
nLSW = pnNumber % 65536  && least significant word
return ToWord( nLSW ) + ToWord( nMSW )

function FromWord( pcBuffer )
return asc( substr( pcBuffer, 2, 1 ) ) * 256 + asc( left( pcBuffer, 1 ) )

function FromLong( pcBuffer )
return FromWord( substr( pcBuffer, 3, 2 ) ) * 65536 + FromWord( left( pcBuffer, 2 ) )
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform