【问题标题】:System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specifiedSystem.ComponentModel.Win32Exception (0x80004005): 系统找不到指定的文件
【发布时间】:2013-06-18 20:12:45
【问题描述】:

我正在尝试使用以下代码在 2 个文件中打开一个文档;

try
{
startInfo.FileName = "WINWORD.EXE";
}
catch(Win32Exception)
{
startInfo.FileName = "TMViewer.exe";
}

我的笔记本电脑上没有消息,所以希望 catch 会触发它在文字查看器程序中打开,但我收到了这条消息;

System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

我已更新注册表以获取运行 TMViewer.exe 的快捷方式,它实际上可以在我的另一台 PC 上运行,但如果我尝试在没有单词的笔记本电脑上运行它,我会不断收到此错误。

【问题讨论】:

    标签: c# unhandled-exception


    【解决方案1】:

    当您Start() 进程时抛出异常,而不是在您设置该选项时。

    但是,您无需执行任何操作。
    相反,只需将FileName 设置为您要打开的文档,Windows 就会自动在用户的关联程序中打开它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-24
      • 2018-09-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多