【问题标题】:how to run the exe file in internet explorer by using the .net application如何使用 .net 应用程序在 Internet Explorer 中运行 exe 文件
【发布时间】:2010-09-30 12:46:10
【问题描述】:

我有micromedia flash player的exe文件。我可以使用以下代码从 .net 应用程序运行此文件

private void button1_Click(object sender, EventArgs e)
{
    System.Diagnostics.Process.Start("peopledisplay.exe");
    //System.Diagnostics.Process.Start("iexplorer.exe", "peopledisplay.exe");
}

此代码在单击按钮后启动 micromedia flash 文件。我希望在单击按钮后在 Internet Explorer 中启动此文件。这个怎么做 ?您能否提供我可以解决上述问题的任何代码或链接?

【问题讨论】:

  • 什么是“micromedia flash player”?

标签: c# .net flash executable exe


【解决方案1】:

试试这个:

System.Diagnostics.Process.Start(@"\"C:\Program Files (x86)\Internet Explorer\iexplore.exe\" \"[path to my file]\"");

您需要在 IE 的命令行中指定 flash 文件的路径。确保用引号将路径括起来。当然,这并不能保证 IE 确实能够运行该文件,您可能会发现安全限制(区域规则、组策略)阻止了这一点。

【讨论】:

    【解决方案2】:

    您在这段代码中所做的是告诉服务器打开可执行文件,而不是浏览器客户端。您需要一些类似下面的 JavaScript,但这可能只在 Internet Explorer 中有效,并且只有当用户在 IE 选项窗口中明确设置权限时。

    <script>
         function go() {
           w = new ActiveXObject("WScript.Shell");
           w.run('peopledisplay.exe');
           return true;
           }
    
         </script>
    
         <form>
           Run Notepad (Window with explorer only)
             <input type="button" value="Go" 
             onClick="return go()">
        </form> 
    

    【讨论】:

    • 我是 .net 框架的新手。我正在开发 Windows 应用程序。你能告诉我应该在哪里写这段代码吗?请一步一步告诉。
    • @Shailesh - 您已经将其标记为答案,因此您可能需要取消标记。这个答案是在网页中运行的脚本,因此它无法在您的 winforms 应用程序中运行。
    • 对不起,我在想 ASP.NET 和 Internet Explorer 等等。 Flash 编译的 exe 不能从浏览器运行,它是一个可执行文件。您应该(如果可以的话)获取 .SWF 文件,并按照 Slugster 告诉您的方式通过浏览器运行该文件。
    猜你喜欢
    • 1970-01-01
    • 2021-12-16
    • 2015-03-02
    • 2012-06-06
    • 2011-07-22
    • 1970-01-01
    • 2013-12-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多