我通過這個命令在我的應用程序啓動時註冊DLL:如何在我的應用程序中隱藏DLL註冊消息窗口?
System.Diagnostics.Process.Start("regsvr32",strPath);
和運行這行代碼後,會出現一個窗口,上面寫着DLL註冊成功與否。
我的問題是,我該如何隱藏這個窗口在我的應用程序?
我通過這個命令在我的應用程序啓動時註冊DLL:如何在我的應用程序中隱藏DLL註冊消息窗口?
System.Diagnostics.Process.Start("regsvr32",strPath);
和運行這行代碼後,會出現一個窗口,上面寫着DLL註冊成功與否。
我的問題是,我該如何隱藏這個窗口在我的應用程序?
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);
thanx,但是我應該在哪裏添加DLL的locationPath? –
@ strPath'中的Shima.Y。 (例如)'strPath = Application.StartupPath +「//myDll.dll」;' –
如果我像定義的那樣定義進程,在啓動方法中,我無法傳遞strPath,我可以直接調用Start()而不帶參數! –
使用/s – Silent; display no message boxes (added with Windows XP and Windows Vista)
選項。
來源:What is the different between /n and /i parameters of RegSvr32.exe?
你會幫助我的代碼嗎?我應該在上面的代碼中添加/ s? –
http://stackoverflow.com/questions/3268022/process-start-arguments或者簡單Process.Start(「regsvr32」,「/ s/i path/to/lib.dll」) – csharpfolk
輸入regsvr32.exe /?查看命令行選項。 –