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:
[color=blue]
> 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?
> --------------------[color=green]
> >From: "Paul" <paul@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: <1146422363.465769.284070@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[/color]
> 18:39:28 GMT)[color=green]
> >X-Complaints-To:
groups-abuse@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[/color]
> CLR 1.1.4322; .NET CLR 1.0.3705; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe)[color=green]
> >Complaints-To:
groups-abuse@google.com
> >Injection-Info: j73g2000cwa.googlegroups.com; posting-host=80.139.117.112;
> > posting-account=gSJLpA0AAADKotUi5Y3_RDioGP1EBxvc
> >Path:[/color]
> 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[color=green]
> >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.
> >
> >[/color]
>
> {\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:
sdkcomm@microsoft.com\par
> \f1\par
> }[/color]