P
PaulK
I am using an ActiveX control to print input documents and their OLE
attachments to the proper applications. I am attempting to have the
documents print silently. I print them in a loop calling ShellExecuteEx for
each one in turn. Parameters are the same for all.
E.g my program receives a report with a PDF file and two embedded OLE Word
attachments. My loop first prints the PDF and it prints silently with no
Popups whatsoever. After successfully extracting the OLE attachments and
storing them in locally saved .doc file, I print them in the same loop using
the same ShellExecuteEx parameters.
Everything works except that Word pops up its window and a "Printing" dialog
box with a Cancel button in it. This "Printing" dialog is used by Word to
alert the user which page is currently printing. This dialog gets focus and
when the user presses the "Enter" key in another application when this dialog
pops up, it seems to be going to this dialog instead of the other
application, thus cancelling the printing. At least that is what looks like
is happening. The document fails to print. I monitor the print queue and it
never shows up in the queue. With no intervening "Enter" key it works
perfectly. All documents print.
Here is the code I use to execute Word:
//launch the application to print the file
SHELLEXECUTEINFO sei;
memset((LPVOID) &sei, NULL, sizeof(sei));
sei.cbSize = sizeof(sei);
sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT |
SEE_MASK_DOENVSUBST;
sei.lpVerb = szExecVerb;
sei.lpFile = lpszFile;
sei.lpParameters = lpszExecParm;
sei.nShow = SW_HIDE;
BOOL fSuccess = ShellExecuteEx(&sei);
lpVerb is "printto"
lpFile is a locally stored .doc file name
lpParameters are "<mydevice>" "winspool" "<myport>"
First question: Does my analysis that the "Printing" dialog getting the
"Enter" key and cancelling printing make sense?
Second Question: Is there anyway to suppress the "Printing" dialog and
ensure that when it comes up it does not get focus?
attachments to the proper applications. I am attempting to have the
documents print silently. I print them in a loop calling ShellExecuteEx for
each one in turn. Parameters are the same for all.
E.g my program receives a report with a PDF file and two embedded OLE Word
attachments. My loop first prints the PDF and it prints silently with no
Popups whatsoever. After successfully extracting the OLE attachments and
storing them in locally saved .doc file, I print them in the same loop using
the same ShellExecuteEx parameters.
Everything works except that Word pops up its window and a "Printing" dialog
box with a Cancel button in it. This "Printing" dialog is used by Word to
alert the user which page is currently printing. This dialog gets focus and
when the user presses the "Enter" key in another application when this dialog
pops up, it seems to be going to this dialog instead of the other
application, thus cancelling the printing. At least that is what looks like
is happening. The document fails to print. I monitor the print queue and it
never shows up in the queue. With no intervening "Enter" key it works
perfectly. All documents print.
Here is the code I use to execute Word:
//launch the application to print the file
SHELLEXECUTEINFO sei;
memset((LPVOID) &sei, NULL, sizeof(sei));
sei.cbSize = sizeof(sei);
sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT |
SEE_MASK_DOENVSUBST;
sei.lpVerb = szExecVerb;
sei.lpFile = lpszFile;
sei.lpParameters = lpszExecParm;
sei.nShow = SW_HIDE;
BOOL fSuccess = ShellExecuteEx(&sei);
lpVerb is "printto"
lpFile is a locally stored .doc file name
lpParameters are "<mydevice>" "winspool" "<myport>"
First question: Does my analysis that the "Printing" dialog getting the
"Enter" key and cancelling printing make sense?
Second Question: Is there anyway to suppress the "Printing" dialog and
ensure that when it comes up it does not get focus?