Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copyfile API Having to call twice help
Message
 
 
À
24/05/2009 18:34:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
01401706
Message ID:
01401710
Vues:
61
>Hi,
>
>I have a large string that VFP can not handle so I'm creating a file using low level FCREATE/FWRITE functions. When
>finished I need to send the file to a printer. The only method that seems to work is the COPYFILE() Windows API but
>90% of the time I have to call the COPYFILE() API two times for it to print.
>
>The first call goes to the que then the que clears. Like it never existed.. If I make a second call then it prints.
>If I continue to use the COPYFILE() command after the 2nd attempt then all additional COPYFILE() commands work.
>
>Meaning the first call fails the second call prints and if I call the function a thrid time it also prints. So it's just the
>first call to the API COPYFILE() that fails. If this was consistant then there would not be a problem but once I'm conneted
>and getting print jobs if I call the COPYFILE() twice I'll get to many copies to the printer.
>
>Got any ideas?
>
>Thanks here is the declare and copyfile() code.
>
>DECLARE INTEGER CopyFile IN KERNEL32.DLL ;
> STRING @SourceFileName, ;
> STRING @DestFileName, ;
> INTEGER bFailIfExists
>
>COPYFILE(l_file4,//print_server/TXT_PRINTER,0) && first call does not print
>COPYFILE(l_file4,//print_server/TXT_PRINTER,0) && Same call now it prints.

May be you need to somehow activate the printer first?

Also did you try something like

SET DEVICE to printer, etc.?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform