![](/img/trans.png)
[英]System.ComponentModel.Win32Exception (0x80004005): Access is denied
[英]System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
我正在嘗試使用以下代碼打開兩個文件之一中的文檔:
try
{
startInfo.FileName = "WINWORD.EXE";
}
catch(Win32Exception)
{
startInfo.FileName = "TMViewer.exe";
}
我的筆記本電腦上沒有 MS Word,所以我希望 catch 會觸發它在 Word 查看器程序中打開,但我收到了這條消息:
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
我已更新注冊表以獲取運行TMViewer.exe
的快捷方式,它實際上可以在我的另一台 PC 上運行,但如果我嘗試在沒有安裝 Word 的筆記本電腦上運行它,我會不斷收到此錯誤。
當您Start()
進程時拋出異常,而不是在您設置該選項時。
但是,您無需執行任何操作。
相反,只需將FileName
設置為您要打開的文檔,Windows 就會自動在用戶的關聯程序中打開它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.