I'm printing a document by creating a System.Diagnostics.Process
object and then setting the StartInfo
verb to "print", then calling the process Start()
method.
I want this print process to be hidden, so I'm setting CreateNoWindow = true
and WindowStyle = ProcessWindowStyle.Hidden
. But the application (Word or Acrobat) still appears during the printing.
I know that the hidden process settings are ignored if a username or password is set for the process and I've debugged through and verifyied they are empty. I've even tried explicitly setting them to NULL to no avail.
I'm wondering if the action of printing makes the application behave as if it requires user intervention (Word displays a "printing document.." dialog box) which negates the settings to hide it.
I'm using .Net 2.0, C#, Word 2007 and Windows Vista.
My actual code is as follows:
System.Diagnostics.Process shellProcess = new System.Diagnostics.Process();
shellProcess.StartInfo.FileName = fullFileName;
shellProcess.StartInfo.CreateNoWindow = true;
shellProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
shellProcess.StartInfo.Verb = "print";
shellProcess.Start();
Help is really appreciated...
Note that I'm aware that I can use the Word or Acrobat API to achive the same thing but this question is specifically about the visibility of the shell process.