Communication avec pda

ducker88 Messages postés 277 Date d'inscription lundi 9 février 2004 Statut Membre Dernière intervention 4 mai 2008 - 3 mai 2006 à 14:56
Mike Gagnon Messages postés 381 Date d'inscription vendredi 15 octobre 2004 Statut Membre Dernière intervention 24 octobre 2013 - 4 mai 2006 à 12:57
Bonjour,
Voila je cherche à recuperer des fichiers sur un pocket pc à l'aide d'une appli foxpro.
J'ai integré le code suivant dans mon appli :
DECLARE INTEGER CeRapiInit IN rapi


DECLARE INTEGER CeCopyFile IN rapi;
    STRING  lpExistingFileName,;
    STRING  lpNewFileName,;
    INTEGER bFailIfExists
, ----

CeRapiInit()
CeCopyFile("c:\temp\test.txt", "\temp\test.txt", 1)
Mais cela ne marche pas. Sur internet j'ai trouvé

Parameters:, ----
, ----
lpExistingFileName
[in] Long pointer to a null-terminated string that specifies the name of an existing file.

lpNewFileName
[in] Long pointer to a null-terminated string that specifies the name of the new file.

bFailIfExists
[in] Boolean value that specifies how this operation is to proceed if a file of the same name as that indicated by lpNewFileName already exists.

Mais tous cela ne m'aide pas beaucoup. Quelqu'un a t'il deja fait cela ?

Merci
duck88

3 réponses

Mike Gagnon Messages postés 381 Date d'inscription vendredi 15 octobre 2004 Statut Membre Dernière intervention 24 octobre 2013 2
3 mai 2006 à 19:04
Un peu plus complexe que ca ce genre de communication. Les chemins (de et à ) doivent traduit en Unicode avec STRCONV

FUNCTION ToUnicode(cStr)
RETURN STRCONV(cStr+CHR(0), 5)
0
ducker88 Messages postés 277 Date d'inscription lundi 9 février 2004 Statut Membre Dernière intervention 4 mai 2008
4 mai 2006 à 08:54
J'ai fait ce que tu m'a dis :


DECLARE INTEGER CeRapiInit IN rapi


DECLARE INTEGER CeCopyFile IN rapi;


STRING lpExistingFileName,;


STRING lpNewFileName,;


INTEGER bFailIfExists


&& on utilise la librairie RAPI.dll


mon_chemin = "c:\temp2\allsortie.txt"


ma_destination = "\Temp\allsortie.txt"


monchemin2 = STRCONV(mon_chemin+CHR(0), 5)


madestination2 = STRCONV(ma_destination+CHR(0), 5)


toto = CeRapiInit()


MESSAGEBOX(toto)


toto1 = CeCopyFile(monchemin2, madestination2, 1)


MESSAGEBOX(toto1)

Mais aucun resultat. toto et toto1 renvoient 0.
Une solution ?

duck88
0
Mike Gagnon Messages postés 381 Date d'inscription vendredi 15 octobre 2004 Statut Membre Dernière intervention 24 octobre 2013 2
4 mai 2006 à 12:57
toto = CeRapiInit()

La lgne ci-haut doit surement te donner un erreur, a moins que tu ai la classe CeRapiInit(), que ne semble pas etre le cas. Si c'est le cas, enleve la ligne.



FUNCTION CopyFile(cSourceName, cTargetName) As Boolean
IF CeCopyFile(m.ToUnicode(cSourceName),;
ToUnicode(m.cTargetName), 1) = 0
RETURN .F.
ENDIF
RETURN .T.
0
Rejoignez-nous