1
s += "<p style=\"text-align: left;\"><a href=\"javascript:window.print()\">PRINT</a></p>";
System.IO.File.WriteAllText(@"CheckForm.html", s);
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.FileName = "explorer.exe";
startInfo.Arguments = "CheckForm.html";
System.Diagnostics.Process.Start(startInfo);

当我尝试在 Windows 7 中打开我的 C# Windows 应用程序时遇到问题,否则没有问题。

我无法使用上述代码在 Windows 7 中打开 explorer.exe。

有什么建议么?

4

2 回答 2

3

要打开 HTML 文件,您应该简单地调用Process.Start文件的路径,如下所示:

Process.Start(@"CheckForm.html");

这将在默认程序中打开文件。(通常是 IE 或 Firefox)

于 2010-03-25T23:44:37.843 回答
1

explorer.exe是 Windows 资源管理器或桌面系统。您可能想要打开 Internet Explorer,进程名称为iexplore.exe.

Windows Explorer 以前与 Internet Explorer 集成,因此 - 根据您输入的路径 - 程序切换到所需的应用程序。IE 用于 url,Windows 资源管理器用于本地路径。这可能是它以前起作用的原因。

然而,我认为在 Vista 中,集成变得松散了,所以这将不再起作用。

于 2010-03-25T23:46:17.477 回答