日期:2014-05-18  浏览次数:20761 次

网页上打开本地的exe程序

本人用java言语开发。
怎么在网页上打开本地的exe程序。 典型例子:如浩方上面的CS那个,启动本地CS.exe 直接打开。 
小弟谢谢了

------解决方案--------------------
在网页中就用javascript 就可以啦,,!

<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
function executeCommands(inputparms)
{
// Instantiate the Shell object and invoke 
its execute method.

var oShell = new ActiveXObject("Shell.Application");

var commandtoRun = "C:\\Winnt\\Notepad.exe";
if (inputparms != "")
{
var commandParms = document.Form1.filename.value;
}

 // Invoke the execute method.
oShell.ShellExecute(commandtoRun, commandParms, 
"", "open", "1");
}
</SCRIPT>

在body 中就加两个button
<input type="Button" name="Button1" 
value="Run Notepad.exe" onClick="executeCommands()" />

<input type="Button" name="Button2" 
value="Run Notepad.exe with Parameters" 
onClick="executeCommands(' + hasPARMS + ')" />


希望用javascript能解决你的问题
------解决方案--------------------
在网页中使用javabean,在里面写段代码就可以了。用RunTime 类
比如:
Runtime rc=Runtime.getRuntime();
rc.exec("要打开程序的路径");
------解决方案--------------------
你可以用javascript启动客户端的应用程序
代码如下:
<script language="JavaScript">
var Shell=new ActiveXObject("WScript.Shell");
try{
 var cmd="mspaint.exe";
 var aa=Shell.Run(cmd,true);
}
catch(e)
 
{
alert("目录文件不存在!");
}
</Script>