Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass a date to a DLL?
Message
 
To
14/12/1997 18:54:41
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00065737
Message ID:
00066125
Views:
46
>>I've not yet been able to solve the date problem. Here is what I am trying to achieve:
>>
>>************************************************************
>>* PROCEDURE DPICreateMvt()
>>************************************************************
>>* Author............: José Constant
>>* Project...........: AutoSoft
>>* Created...........: 13/12/97 13:51:01
>>* Copyright.........: (c) CSS, jose@club.innet.be, 1997
>>*) Description.......: Création d'un mouvement dans le fichier temporaire
>>* Calling Samples...:
>>* Parameter List....: nHandle, le handle de la société
>>* : cJournal C(3), le journal comptable
>>* : la date de l'écriture (as a string of 6 bytes)
>>* : cNumPiece C(12), le numéro de pièce
>>* : cLibelle C25), le libellé de l'opération
>>* Returns...........: le handle du mouvement créé ou 0 en cas derreur
>>* Major change list.:
>>
>>DECLARE INTEGER DPICreateMvt IN DPID32 ;
>> INTEGER nHandle, ;
>> STRING @cJournal, ;
>> STRING @cDate, ;
>> STRING @cNumPiece, ;
>> STRING @cLibelle
>>
>>
>>LOCAL nHandle
>>nHandle = 0
>>
>>nHandle = DPIOpenSociete("JCM", "LIPEZB", "BIDON" )
>>
>>*-- so far I get a handle
>>
>>cJournal = "VEN"
>>lnJour = 14
>>lnMois = 12
>>lnAnnee = 97
>>
>>lcJour = CHR(lnJour % 256) + CHR(INT(lnJour/256))
>>lcMois = CHR(lnMois % 256) + CHR(INT(lnMois/256))
>>lcAnnee = CHR(lnAnnee % 256) + CHR(INT(lnAnnee/256))
>>
>>cDate = lcJour+lcMois+lcAnnee
>>cNumPiece = "999 "
>>cLibelle = "TEST "
>>
>>nMvtHandle = DPICreateMvt( ;
>> nHandle, ;
>> cJournal, ;
>> cDate, ;
>> cNumPiece, ;
>> cLibelle )
>>
>>? nMvtHandle
>>nMvtHandle always returns 0, so I still have an error...
>>
>>José
>
>Another general rule for DECLARE:
>
>If the parameter is a char string, declare it as passed by reference and pass it by reference.
>
>So far, you declare them as passed by reference, but you pass them by value. I know I've read somewhere in some docs that this is correct... but it is not correct. Try the following:
>
>nMvtHandle = DPICreateMvt( ;
> nHandle, ;
> @cJournal, ;
> @cDate, ;
> @cNumPiece, ;
> @cLibelle)
>
>If this still doesn't work, pad the char strings to the required length with space at right (using PADR()). Depending on how this strings are handled internally by the DLL function, this may be important (ie: to pass the correct length strings).
>
>Hope it will work this time! Good luck!
>
>Vlad


Vlad,

Still the same bad result. I'll try to locate a newer version of the .DLL (that was supposed to fix some bugs) and if I don't get any further I'll call the guy who made it. I'll let you know how it ends up.

Thank you a lot, I've learned very interesting stuff.

José
Previous
Reply
Map
View

Click here to load this message in the networking platform