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?
Try to add this line: