>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