I print a document by creating an object System.Diagnostics.Processand then setting the verb StartInfoto "print" and then calling the method Start().
I want this printing process to be hidden, so I install CreateNoWindow = trueand WindowStyle = ProcessWindowStyle.Hidden. But the application (Word or Acrobat) still appears during printing. A.
I know that hidden process parameters are ignored if a username or password is set for the process, and I debugged and checked that they are empty. I even tried to explicitly set them to NULL to no avail.
I am wondering if the print action affects the behavior of the application, as if it required user intervention (Word displays the "document to print ..." dialog box), which overrides the settings to hide it.
I am 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 ...
Please note that I know that I can use the Word or Acrobat API to achieve the same thing, but this question specifically relates to the visibility of the shell process.
source
share