#define SW_HIDE 0
#define SW_SHOWNORMAL 1
#define SW_NORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_SHOWMAXIMIZED 3
#define SW_MAXIMIZE 3
#define SW_SHOWNOACTIVATE 4
#define SW_SHOW 5
#define SW_MINIMIZE 6
#define SW_SHOWMINNOACTIVE 7
#define SW_SHOWNA 8
#define SW_RESTORE 9
#define SW_SHOWDEFAULT 10
#define SW_FORCEMINIMIZE 11
Using win7
using SW_HIDE opens acrobat in a normal window, prints, then minimizes
using SW_SHOWMINIMIZED does its thing minimized
using SW_SHOWMINNOACTIVE (what I proposed) works as SW_SHOWMINIMIZED
Now that may not work on all systems - I have only win7
If it works - don't read any further
What I do is
(1) Create an object (with a timer and timeout) that sends SW_MINIMIZE to any window that becomes the foregroundwindow
(2) If acrobat is not started, start one. The new one will receive a SW_MINIMIZE from (1)
I take the 'Open' command from the pdf extension in the registry
I am now sure to have an acrobat that is minimized
(3) I launch the command
ShellExecute(GetDesktopWindow(), 'printto', m.pdfFile, '"' + m.printerName + '"', null, 7)
I remember ( was it up to acrobat 6 or 7 ) lauching acrobat directly with parameters - there were 4 of them
(a) fileName
(b) printername
(c) printerdriver
(d) printerport
Starting with acrobat 8, I could not get it to work with the 4 parameters
I believe - but then it's a while ago - that the method (1)/(2)/(3) works with previous and current versions
>One last thing..
>
>ShellExecute(0, 'printto', lcoutputfile, '"' + lcprinterName + '"', null, SW_HIDE)
>
>My output file is a pdf. So.. the adobe reader get launched to do the print.
>I want the reader to be minimized or hidden.
>
>SW_HIDE does not hide the reader. Is there an integer that will hide or minimize the reader?
>
>
>
>
>>>Yes. It does work. A simple solution. Thanks again.
>>>
>>
>>You're welcome, Debra
>>
>>
>>>>Debra,
>>>>
>>>>>Would you know, off hand, if I can I pass the tray as well?
>>>>
>>>>Not really - but I think there's a way around
>>>>
>>>>I have my same printer added twice, for the second I change the properties to use Black and White printing.
>>>>If I want to print something in black & white, I simply select the Black and white printer
>>>>
>>>>
>>>>I suspect the same will apply to your tray question
>>>>
>>>>(1) Add another printer - eg Printer_Tray_2
>>>>
>>>>(2) Change its properties to use a specific tray - here # 2
>>>>
>>>>
>>>>Now print to printer 'Printer_Tray_2'
>>>>
>>>>
>>>>
>>>>
>>>>>Greg,
>>>>>
>>>>>Thank you so much. The printto in the shell execute is working beautifully.
>>>>>Very very nice...
>>>>>
>>>>>Would you know, off hand, if I can I pass the tray as well?
>>>>>
>>>>>
>>>>>>>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.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>Debra,
>>>>>>
>>>>>>I have not followed the whole thread - but try this
>>>>>>
>>>>>>- no need to change the default windows printer
>>>>>>- pass the printer name to ShellExecute as a parameter
>>>>>>
>>>>>>
>>>>>> declare integer GetDesktopWindow IN win32api
>>>>>>
>>>>>> Declare long ShellExecute in shell32.dll ;
>>>>>> long hwnd, ;
>>>>>> string lpszOp, ;
>>>>>> string lpszFile, ;
>>>>>> string lpszParams, ;
>>>>>> string lpszDir, ;
>>>>>> long nShowCmd
>>>>>>
>>>>>> local pdfFile, printerName
>>>>>> pdfFile = 'd:\tmp\0xx.pdf'
>>>>>> pdfFile = 'd:\tmp\aaa.pdf'
>>>>>>
>>>>>> printerName = 'HP Photosmart C6100 series'
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ?ShellExecute(GetDesktopWindow(), 'printto', m.pdfFile, '"' + m.printerName + '"', null, 7)
>>>>>>
Gregory