Temporary set windows default printer

m.hansler

New Member
Hi all,

In a query I generate a pdf with PDFInclude and at the end it prints the file (stored in cFilename) with ShellExecuteA.

Before that the user has the possibility to choose the a printer to print to.

SYSTEM-DIALOG PRINTER-SETUP UPDATE OKpressed.
IF OKpressed THEN
strPrinter = SESSION:PRINTER-NAME.

RUN ShellExecuteA (0,"print":u,cFileName,"","",1,output tInt).

Obviously Acrobat Reader prints the pdf file to the default windows printer.

So...
- Is there any way to insert the value of strPrinter in the parameters of ShellExecuteA ?
or
- Is there any way to temporary set the windows default printer to the value of strPrinter and at the end put it back to the original setting?
 
Output to PDF file (variable). Then in a different command open that file. IF on a Windows box, the file type should already be asociated with the open with already assigned. Let Windows do the hard work.
 
This what you are looking for? http://www.oehive.org/node/500

Thanks tamhas, I tried Method 2, but no luck.

We have workstations on w2k and xp so I changed "winspool.dll" to "winspool.drv" and used the run command in different forms.

run SetDefaultPrinter("\\servername\printername").
or
run SetDefaultPrinter("ip-address").
or
run SetDefaultPrinter("local printername").

The defaultprinter doesn't change.
Maybe i'm overlooking something in this code.
 
Thanks tamhas, I tried Method 2, but no luck.

Well, perhaps you should try the other method and then, if you don't have any luck, post a comment on that page asking for help since that is where the author is likely to look.
 
Back
Top