Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert a negative value into hexadecimal
Message
From
16/01/2003 15:49:23
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00742608
Message ID:
00742619
Views:
20
>When I needed to convert a negative value into hexadecimal to use it in a WinAPI function I used this routine based in a clever conversion function by Ed Rauh. It works like a charm in Windows 98, but in Windows XP I only get a "Declare DLL caused an exception" error. Anybody kwnows how to make this routine works in WinXP o has an alternative method?
>
>
>Declare Integer RtlMoveMemory in Win32API String @lpDest, Long nSource, Integer nBytes
>
>nNumber = -2141040952
>cRes = Replicate(Chr(0), 4)
>If RtlMoveMemory(@cRes, nNumber, 4) > 0
>
> cHex = ""
> cHex = cHex + Right(Transform(Asc(SubStr(cRes, 1, 1)), "@0"), 2)
> cHex = cHex + Right(Transform(Asc(SubStr(cRes, 2, 1)), "@0"), 2)
> cHex = cHex + Right(Transform(Asc(SubStr(cRes, 3, 1)), "@0"), 2)
> cHex = cHex + Right(Transform(Asc(SubStr(cRes, 4, 1)), "@0"), 2)
> ? cHex
>
>else
> ? "Error"
>Endif

Try this
Declare Integer RtlMoveMemory in Win32API String @lpDest, Long @nSource, Integer nBytes
Herman
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform