Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using Delphi 3 OBJ files in VFP???
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00921063
Message ID:
00921233
Vues:
15
Hi John,

Try this link:
http://www.news2news.com/vfp/?example=45
That was probably Delphi 2 I compiled this Pascal code with.

* * *
To convert FoxPro DWORD or WORD string buffer to FoxPro numeric variable directly in FoxPro code you may try the following functions:
FUNCTION buf2dword(lcBuffer)
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
	BitLShift(Asc(SUBSTR(lcBuffer, 2,1)),  8) +;
	BitLShift(Asc(SUBSTR(lcBuffer, 3,1)), 16) +;
	BitLShift(Asc(SUBSTR(lcBuffer, 4,1)), 24)

FUNCTION buf2word(lcBuffer)
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
       Asc(SUBSTR(lcBuffer, 2,1)) * 256
The names of the functions are some kind fuzzy, you probably can come with better ones. The BitLShift also poses some limits. Still it works, I use them all the time with API calls.

To convert FoxPro numeric to either DWORD or WORD string buffer you may try two other functions:
FUNCTION num2dword(lnValue)
#DEFINE m0  256
#DEFINE m1  65536
#DEFINE m2  16777216
	IF lnValue < 0
		lnValue = 0x100000000 + lnValue
	ENDIF
	LOCAL b0, b1, b2, b3
	b3 = Int(lnValue/m2)
	b2 = Int((lnValue - b3*m2)/m1)
	b1 = Int((lnValue - b3*m2 - b2*m1)/m0)
	b0 = Mod(lnValue, m0)
RETURN Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3)

FUNCTION num2word(lnValue)
RETURN Chr(MOD(m.lnValue,256)) + CHR(INT(m.lnValue/256))
Also check this link on FoxPro Wiki:
http://fox.wikis.com/wc.dll?Wiki~VFPFloatingPointDataType
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform