Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert a negative value into hexadecimal
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00742608
Message ID:
00742932
Vues:
21
>This way it works, however the result is different. I will try if it isn't rejected by the WinAPI function.

That's the way it is. It's nothing to do with the API function. The result is different because you take it forward.

Take your sample number:
-2141040952 = "80 62 4E C8"
It will stored in memory/register as "C8 4E 62 80"
You will get the wrong result if you take it forward. So you must take it backward.
cHex = ""
cHex = cHex + Right(Transform(Asc(SubStr(cRes, 4, 1)), "@0"), 2)
cHex = cHex + Right(Transform(Asc(SubStr(cRes, 3, 1)), "@0"), 2)
cHex = cHex + Right(Transform(Asc(SubStr(cRes, 2, 1)), "@0"), 2)
cHex = cHex + Right(Transform(Asc(SubStr(cRes, 1, 1)), "@0"), 2)

And it is the way CPU stored DWORD in memory/register.
Btw, just a curiousity. Why don't you use Transform(-2141040952, '@0'), the result is correct.

>Thanks a lot for you help.
Anytime :)
Herman
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform