2016-01-23 48 views
1

我通過這個命令在我的應用程序啓動時註冊DLL:如何在我的應用程序中隱藏DLL註冊消息窗口?

System.Diagnostics.Process.Start("regsvr32",strPath); 

和運行這行代碼後,會出現一個窗口,上面寫着DLL註冊成功與否。

我的問題是,我該如何隱藏這個窗口在我的應用程序?

+0

輸入regsvr32.exe /?查看命令行選項。 –

回答

2
Process proc = new Process 
{ 
    StartInfo = 
    { 
     FileName = "regsvr32", 
     Arguments = "/s" + strPath, 
     RedirectStandardError = true, 
     UseShellExecute = false, 
     CreateNoWindow = true 
    } 
}; 
proc.Start(); 

你也可以這樣做:

System.Diagnostics.Process.Start("regsvr32","/s" + strPath); 
+0

thanx,但是我應該在哪裏添加DLL的locationPath? –

+0

@ strPath'中的Shima.Y。 (例如)'strPath = Application.StartupPath +「//myDll.dll」;' –

+0

如果我像定義的那樣定義進程,在啓動方法中,我無法傳遞strPath,我可以直接調用Start()而不帶參數! –

相關問題