Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass a date to a DLL?
Message
 
To
13/12/1997 23:36:02
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00065737
Message ID:
00065812
Views:
45
>>>Peter,
>>>
>>>Thanks a lot. Here is what I found in the header file.
>>>
>>>typedef struct tagDPIDate
>>>{
>>> short jour;
>>> short mois;
>>> short annee;
>>>} DPIDate, FAR * LPDPIDate;
>>>
>>>I removed the text of your message in this answer because I'm using the offline reader and it's plain memo...
>>>
>>>José
>>
>>The length of the string should be 6.
>>
>>After the dll procedure returns you can unpack it by:
>>lnJour = UnpackShort(substr(m.lcStr, 1, 2))
>>lnMois = UnpackShort(substr(m.lcStr, 3, 2))
>>lnAnnee = UnpackShort(substr(m.lcStr, 5, 2))
>>
>>** Here is a VFP procedure that will unpack the datatype short:
>>function UnpackShort
>> lparameters lcStr
>> assert len(m.lcStr) = 2
>> local lnLeft, lnRight
>> lnLeft = asc(left(m.lcStr, 1))
>> lnRight = asc(right(m.lcStr, 1))
>> return iif(bitand(lnRight, 0x80) = 0x80), -1, 1) * bitor(lnLeft, bitand(lnRight, 0x7f))
>
>I understand why you use the BITAND in the IIF. But I really don't get the part after the "*" sign. IMHO, you can't obtain the correct value using this formula.
>
>I would go for the simple one:
>return lnRight * 256 + lnLeft
>
>Of course, you can add the part for the sign, but I don't see how you can have negative values for day, month or year.
>
>Vlad

Paul and Vlad,

Thanks a lot for your insight. I really have no C experience, so your help is very welcome. I'll try all your good suggestions and will come back to tell you something about my progresses...

José
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform