Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VB type statement using declare statament
Message
 
 
À
11/04/1998 17:42:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00091341
Message ID:
00091358
Vues:
21
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform