Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass a date to a DLL?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00065737
Message ID:
00065792
Vues:
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 think this function should work, but I haven't tested it. If you need it integrated back into the other code snippet, I can do that for you as well.

Peter
Peter Stephens
Visual Records, Inc.

Lead Programmer for the general purpose record keeping system Visual Records. Written primarily in VFP 6.0 with a little C++.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform