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";
sta开发者_如何转开发rtInfo.Arguments = "CheckForm.html";
System.Diagnostics.Process.Start(startInfo);
I'm having a trouble when I tried to open my C# windows application in Windows 7 otherwise there is no problem.
I couldn't open explorer.exe in Windows 7 with above code.
Any suggestions?
To open an HTML file, you should simply call Process.Start
with the path to the file, like this:
Process.Start(@"CheckForm.html");
This will open the file in the default program. (Typically IE or Firefox)
explorer.exe
is the Windows Explorer or desktop system. You probably want to open the Internet Explorer, which process name would be iexplore.exe
.
Windows Explorer was previously integrated with Internet Explorer, so that – depending on the path you enter – the program switches to the wanted application. IE for urls, and Windows Explorer for local paths. That's probably why it worked before.
However with Vista I think, the integration was loosened, so this won't work any longer.
精彩评论