Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the best way to set the Default Printer
Message
De
13/08/2010 10:18:29
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00870520
Message ID:
01476469
Vues:
148
It seems to be working if I close adobe and then set the windows system default printer.

How do you suggest I accomplish this task?

I need to print to a bullzip pdf printer first to create a pdf.
Then, I need to switch to a selected printer to print a hard copy of the pdf.



>Hi Debra,
>
>The SetDefaultPrinter() has no effect on already running Acrobat Reader. It'll keep printing to the default printer set before it started. The only way to force it to print to another printer is to make sure that Acrobat Reader is not running before issuing another SetDefaultPrinter(). However in order to do that you have to make sure that previous file finished printing. You can do that by checking print queue for the job. In any case, it's not very reliable way to accomplish the task.
>
>If you still want to go in this direction, you can find all the pieces on my web site
>
>http://www.berezniker.com/content/pages/visual-foxpro/enumerating-jobs-print-queue
>http://www.berezniker.com/content/pages/visual-foxpro/check-if-exe-running-and-optionally-terminate-it
>
>
>>
>>I'm having a problem setting the default system windows printer.
>>
>>
>>lcprintername = lcdefaultprinter
>>IF SetDefaultPrinter(lcprintername) = 0
>> SELECT(lnalias)
>> messagebox("Cannot change the default windows printer.", 0+16+0,"Error")
>> return .f.
>>ENDIF
>>
>>ShellExecute(0,'Print',lcfile,"","",1)
>>
>>
>>
>>lcprintername = lcotherprinter
>>IF SetDefaultPrinter(lcotherprinter) = 0
>> SELECT(lnalias)
>> messagebox("Cannot change the default windows printer.", 0+16+0,"Error")
>> return .f.
>>ENDIF
>>
>>ShellExecute(0,'Print',lcfile,"","",1)
>>
>>
>>Both times the file gets printed to the first printer.
>>Do you know what's going on with this?
>>Even if I put a delay between them, it doesn't work.
>>If I put lcotherprinter first, both times it prints to lcotherprinter.
>>
>>I can't seem to switch the system printer and print using the shell execute successfully. I'm printing a pdf file.
>>
>>
>>Actually, I print to a bullzip pdf printer first and create the pdf.
>>Then, I need to switch to a selected printer to print a hard copy of the pdf.
>>
>>Can you tell what's wrong here? Doesn't the shell execute do a print to the default windows printer?
>>Is there something else I need to set? Or is this a timing issue?
>>
>>Any help would be greatly appreciated.
>>
>>Deb
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform