2008-10-31 72 views
0

我正在開發一個需要使用regini(由於遺留原因)將某些東西插入到註冊表中的應用程序。我一直在試圖以這樣的方式來執行此操作,該應用程序的用戶不知道這一點。我寫了下面的代碼:從c#應用程序使用regini而不打擾用戶?

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(); 

不幸的是,每次執行代碼時都會彈出'命令'窗口。我的印象是

pi.WindowStyle = ProcessWindowStyle.Hidden; 

會阻止。我該如何防止regini打開自己的命令窗口?

回答

2

嘗試加入這一行:

pi.CreateNoWindow = true; 
相關問題