using process class

  • Thread starter Thread starter Michael Smith
  • Start date Start date
M

Michael Smith

Hi,
I am using the following code to print documents directly
to the default printer
**************
ProcessStartInfo startInfo = new ProcessStartInfo
("<someprogram>.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
startInfo.FileName = filename;
startInfo.Verb = "Print";
Process.Start(startInfo);
**************
the code successfully launches and prints the program,
but the window is not always minimized. I did a few
tests and found out that the window will only minimize if
I manually quit the launched program after each
execution. If the program is left running, or if it is
already running, the window will not be minimized. The
same is true for ProcessWindowStyle.Hidden. is there a
way to make the window stay minimized/hidden all the
time?

Also, certain programs only print the first page (i.e.
Windows Journal). Is there a way to send these programs
the message to pring all pages? or do I have to find
another way to print them?
Thank you in advance.
-michael
 
It still does not work when the application is already
running.
I did
....
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo
("WINWORD.EXE");
process.StartInfo = startInfo;
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.Start();
 
It still does not work when the application is already
running.
I did
.....
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo
("WINWORD.EXE");
process.StartInfo = startInfo;
process.StartInfo.WindowStyle =
ProcessWindowStyle.Minimized;
process.Start();
 
Back
Top