0

I am developing an application that needs to use regini (because of legacy reasons) to insert something into the registry. I have been trying to do this in such a way the the user of the application is not aware of this. I have written the following code:

System.Diagnostics.ProcessStartInfo pi = new ProcessStartInfo();  

pi.FileName = @"c:\windows\system32\regini.exe";
pi.Arguments = name;
pi.WorkingDirectory = Utils.AppSettings.WorkingDirectory.ToString();    
pi.WindowStyle = ProcessWindowStyle.Hidden;
pi.RedirectStandardError = true;
pi.RedirectStandardOutput = true;
pi.UseShellExecute = false;  
Process p = new Process();
p.StartInfo = pi;
p.EnableRaisingEvents = true;
p.Start();

Unfortunately, I still see the 'command' window pop-up every time this code is executed. I was under the impression that

pi.WindowStyle = ProcessWindowStyle.Hidden;

would prevent that. How can I prevent regini from opening its own command window?

4

2 に答える 2

2

この行を追加してみてください:

pi.CreateNoWindow = true;
于 2008-10-31T10:32:57.220 に答える
0

Microsoft Connect フィードバック サイトで次のバグ レポートを見つけました: System.Diagnostics.ProcessWindowStyle.Hidden は、実行中にウィンドウを表示します。

あなたが忘れている何かのヒントがあるかもしれません。

于 2008-10-31T09:01:20.400 に答える