Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I extract a value from a Word?
Message
From
14/12/1997 18:43:46
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00065848
Message ID:
00065858
Views:
31
>From the DPI.H: DPIGetComptaVersion( WORD* wHigh, WORD* Low )
>
>DECLARE INTEGER DPIGetComptaVersion ;
> IN DPID32 ;
> SHORT @nHigh, ;
> SHORT @nLow
>
>nhigh = 0
>nLow = 0
>nWord = DPIGetComptaVersion(@nHigh, @nLow )
>? nWord
>
>this returns 10683142. How should I process that?
>
>If this might be of some help, this DLL has been written in Borland C.
>
>José

WORD = unsigned integer on 2 bytes
SHORT = signed integer on 2 bytes

General rules for DECLARE with WORD or SHORT:

WORD or SHORT parameters:
Declare them as INTEGER. No conversions are needed. VFP does all the conversiond for you. Please notice that there is no SHORT for param declarations.

WORD or SHORT as the returned value:
Declare the returned value as SHORT. This is very important. If you declare it as INTEGER, the returned value will not be correct.

If the return value is WORD: VFP doesn't know how to handle this and some transformation may be needed: Since the returned value sould not be negative, you must test the returned value. If it's negative you must:

lnReturnedValue = lnReturnedValue + 65536

and this will give you the correct value.

If the returned value is SHORT, no correction is necessary.

For your specific case:
I have no idea how you can interpret the returned value. First, you must verify if you declared correctly the type of the returned value. Anyway, only the doc for this function can tell how you must interpret the value. Do you have any other doc?

Seeing that the params are pointers to word, I would say that both of them are output params. So, maybe the function returns the version in these 2 params. For example:

nHigh = 2, nLow = 78 might mean version = 2.78

But this is just a guess. Once again, only the documentation can say this.

Vlad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform