473,326 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Process.Start ignores WindowStyle

Hi,
I am trying to start a process hidden. My code:

wordprocess = new System.Diagnostics.Process(); ;
wordprocess.StartInfo = new System.Diagnostics.ProcessStartInfo(wcmd,
args);
wordprocess.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden;
wordprocess.StartInfo.WorkingDirectory = TemplatePath.Substring(0,
TemplatePath.Length - 1);
wordprocess.StartInfo.ErrorDialog = false;
wordprocess.StartInfo.CreateNoWindow = true;
wordprocess.StartInfo.UseShellExecute = true;

The process is started but it is visible.

CreateNoWindow has no effect because the process I am starting is not a
command line process. I have tried UseShellExecute being true and
false. I have tried to start the process minimized but that has also no
effect. I found several threads discussing this problem but nobody
wrote anything that solves the problem.

With best regards,
Paul Hoepping
Germany.

Apr 30 '06 #1
4 12328
Paul,

Does this Process receive input? If so; the Process Window can not be
Hidden:
Hidden
The hidden window style. A window can be either visible or hidden. The
system displays a hidden window by not drawing it. If a window is hidden,
it is effectively disabled. A hidden window can process messages from the
system or from other windows, but it cannot process input from the user or
display output. Frequently, an application may keep a new window hidden
while it customizes the window's appearance, and then make the window style
Normal.

Is tis what you want?
--------------------
From: "Paul" <pa**@hed.de>
Newsgroups: microsoft.public.dotnet.languages.csharp
Subject: Process.Start ignores WindowStyle
Date: 30 Apr 2006 11:39:23 -0700
Organization: http://groups.google.com
Lines: 26
Message-ID: <11**********************@j73g2000cwa.googlegroups .com>
NNTP-Posting-Host: 80.139.117.112
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1146422368 21500 127.0.0.1 (30 Apr 2006 18:39:28 GMT)X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Sun, 30 Apr 2006 18:39:28 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 1.0.3705; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe)Complaints-To: gr**********@google.com
Injection-Info: j73g2000cwa.googlegroups.com; posting-host=80.139.117.112;
posting-account=gSJLpA0AAADKotUi5Y3_RDioGP1EBxvc
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFT FEEDS01.phx.gbl!newsfeed.c
w.net!cw.net!news-FFM2.ecrc.de!newsfeed.gamma.ru!Gamma.RU!postnews.g oogle.co
m!j73g2000cwa.googlegroups.com!not-for-mailXref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.languages.csharp:401433
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Hi,
I am trying to start a process hidden. My code:

wordprocess = new System.Diagnostics.Process(); ;
wordprocess.StartInfo = new System.Diagnostics.ProcessStartInfo(wcmd,
args);
wordprocess.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden;
wordprocess.StartInfo.WorkingDirectory = TemplatePath.Substring(0,
TemplatePath.Length - 1);
wordprocess.StartInfo.ErrorDialog = false;
wordprocess.StartInfo.CreateNoWindow = true;
wordprocess.StartInfo.UseShellExecute = true;

The process is started but it is visible.

CreateNoWindow has no effect because the process I am starting is not a
command line process. I have tried UseShellExecute being true and
false. I have tried to start the process minimized but that has also no
effect. I found several threads discussing this problem but nobody
wrote anything that solves the problem.

With best regards,
Paul Hoepping
Germany.


{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl {\f0\fnil\fprq2\fcharset0
MS Sans Serif;}{\f1\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2500;}\viewkind4\uc1\pard\f0\fs20 Cheers,\par
\par
johnKn [MS-SDK]\par
\par
\par
\par
-Please do not send email directly to this alias. This alias is for \par
newsgroup purposes only\par
\par
-This posting is provided "AS IS" with no warranties, and confers no
rights.\par
\par
-To provide additional feedback about your community experience please send
\par
e-mail to: sd*****@microsoft.com\par
\f1\par
}

May 8 '06 #2
John,
the process receives no input. If I use C++ and WIN32-API CreateProcess
the process does not become visible.

The process is MS Word and I want it to work on a .doc-File that
contains VBA macro code. When finished, the VBA code will terminate
Word.

It works but Word is visible while working on the VBA macro. I came to
the conclusion that Process.Start may not handle the Hidden-flag
correctly. As a workaround, I am placing my own application window in
front of word. Later I will probably have to write a little C++ process
that handles starting Word.

Another solution would be to use the Word COM-objects instead of
starting Word as a new process. I do not really like that solution. It
creates dependencies I would like to avoid and an in-process COM object
may have adverse effects on my application. When started as an external
process, Word cannot hurt my application and I can terminate the
process if it behaves badly.

Anyway, thanks for your help.

Regards,
Paul Hoepping

John Kn [MS] schrieb:
Paul,

Does this Process receive input? If so; the Process Window can not be
Hidden:
Hidden
The hidden window style. A window can be either visible or hidden. The
system displays a hidden window by not drawing it. If a window is hidden,
it is effectively disabled. A hidden window can process messages from the
system or from other windows, but it cannot process input from the user or
display output. Frequently, an application may keep a new window hidden
while it customizes the window's appearance, and then make the window style
Normal.

Is tis what you want?
--------------------
From: "Paul" <pa**@hed.de>
Newsgroups: microsoft.public.dotnet.languages.csharp
Subject: Process.Start ignores WindowStyle
Date: 30 Apr 2006 11:39:23 -0700
Organization: http://groups.google.com
Lines: 26
Message-ID: <11**********************@j73g2000cwa.googlegroups .com>
NNTP-Posting-Host: 80.139.117.112
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1146422368 21500 127.0.0.1 (30 Apr 2006

18:39:28 GMT)
X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Sun, 30 Apr 2006 18:39:28 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET

CLR 1.1.4322; .NET CLR 1.0.3705; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe)
Complaints-To: gr**********@google.com
Injection-Info: j73g2000cwa.googlegroups.com; posting-host=80.139.117.112;
posting-account=gSJLpA0AAADKotUi5Y3_RDioGP1EBxvc
Path:

TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFT FEEDS01.phx.gbl!newsfeed.c
w.net!cw.net!news-FFM2.ecrc.de!newsfeed.gamma.ru!Gamma.RU!postnews.g oogle.co
m!j73g2000cwa.googlegroups.com!not-for-mail
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.languages.csharp:401433
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Hi,
I am trying to start a process hidden. My code:

wordprocess = new System.Diagnostics.Process(); ;
wordprocess.StartInfo = new System.Diagnostics.ProcessStartInfo(wcmd,
args);
wordprocess.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden;
wordprocess.StartInfo.WorkingDirectory = TemplatePath.Substring(0,
TemplatePath.Length - 1);
wordprocess.StartInfo.ErrorDialog = false;
wordprocess.StartInfo.CreateNoWindow = true;
wordprocess.StartInfo.UseShellExecute = true;

The process is started but it is visible.

CreateNoWindow has no effect because the process I am starting is not a
command line process. I have tried UseShellExecute being true and
false. I have tried to start the process minimized but that has also no
effect. I found several threads discussing this problem but nobody
wrote anything that solves the problem.

With best regards,
Paul Hoepping
Germany.


{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl {\f0\fnil\fprq2\fcharset0
MS Sans Serif;}{\f1\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2500;}\viewkind4\uc1\pard\f0\fs20 Cheers,\par
\par
johnKn [MS-SDK]\par
\par
\par
\par
-Please do not send email directly to this alias. This alias is for \par
newsgroup purposes only\par
\par
-This posting is provided "AS IS" with no warranties, and confers no
rights.\par
\par
-To provide additional feedback about your community experience please send
\par
e-mail to: sd*****@microsoft.com\par
\f1\par
}


May 23 '06 #3
Hello Paul,

Have you been able to solve this problem?

We're having a similar one.

Best wishes,
Alex.

Paul <pa**@hed.dewrote:
John,
the process receives no input. If I use C++ and WIN32-API CreateProcess
the process does not become visible.

The process is MS Word and I want it to work on a .doc-File that
contains VBA macro code. When finished, the VBA code will terminate
Word.

It works but Word is visible while working on the VBA macro. I came to
the conclusion that Process.Start may not handle the Hidden-flag
correctly. As a workaround, I am placing my own application window in
front of word. Later I will probably have to write a little C++ process
that handles starting Word.

Another solution would be to use the Word COM-objects instead of
starting Word as a new process. I do not really like that solution. It
creates dependencies I would like to avoid and an in-process COM object
may have adverse effects on my application. When started as an external
process, Word cannot hurt my application and I can terminate the
process if it behaves badly.

Anyway, thanks for your help.

Regards,
Paul Hoepping
--
Address email to user "response" at domain "alexoren" with suffix "com"

Jul 19 '06 #4
Hi Alex,

no, I have made no progress solving this problem. The best I can do is:

Before starting the new process, I make my own window TopMost. When
start MS Word, the new window appears behind my own application window.
Within the VBA macro I have programmed that MS Word minimizes itself.
So, after a couple a seconds, MS Word disappears.

If you find a solution, please let me know.

With best regards,
Paul Hoepping.
Alex schrieb:
Hello Paul,

Have you been able to solve this problem?

We're having a similar one.

Best wishes,
Alex.

Paul <pa**@hed.dewrote:
John,
the process receives no input. If I use C++ and WIN32-API CreateProcess
the process does not become visible.

The process is MS Word and I want it to work on a .doc-File that
contains VBA macro code. When finished, the VBA code will terminate
Word.

It works but Word is visible while working on the VBA macro. I came to
the conclusion that Process.Start may not handle the Hidden-flag
correctly. As a workaround, I am placing my own application window in
front of word. Later I will probably have to write a little C++ process
that handles starting Word.

Another solution would be to use the Word COM-objects instead of
starting Word as a new process. I do not really like that solution. It
creates dependencies I would like to avoid and an in-process COM object
may have adverse effects on my application. When started as an external
process, Word cannot hurt my application and I can terminate the
process if it behaves badly.

Anyway, thanks for your help.

Regards,
Paul Hoepping

--
Address email to user "response" at domain "alexoren" with suffix "com"
Aug 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tippy G | last post by:
I have written code to start another process and a form is displayed within my app to let the user know the process is running. The problem is the process runs in normal mode and shows in front of...
2
by: Michael Smith | last post by:
Hi, I am using the following code to print documents directly to the default printer ************** ProcessStartInfo startInfo = new ProcessStartInfo ("<someprogram>.exe");...
3
by: James Li | last post by:
I have the code below, the first process takes about 10 minutes to finish. But the waitForExit doesn't seem to wait when I debug the program, it go immediately to execute code after the...
6
by: gizmo | last post by:
I have a requirement to initiate more than one instance of an application using the filenames. (the example below will start two instances of MS Word). My problem is that I need to kill each...
15
by: jcrouse | last post by:
Here is my code: Dim sw As StreamWriter = File.CreateText(Application.StartupPath & "\mameversion.bat") sw.WriteLine(lblMameExePath.Text & " -help >""" & Application.StartupPath &...
6
by: jcrouse | last post by:
This is kind of a continuation of another thread that was somewhat resolved: Well, the dilemma seems to be this. I want to be able to hide the DOS box AND pause the code until execution is...
10
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden...
9
by: kimiraikkonen | last post by:
Hello, I want to automate something and display a simple msgbox that indicates my external process finished processing and "exited". My code is that, what things should i add more: Dim psInfo...
2
by: alag20 | last post by:
Hi, I need to start a new process from c#. I am currently doing it as below ProcessStartInfo psi = new ProcessStartInfo(@"appname"); psi.RedirectStandardOutput = true;...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.