我做了个测试页面,代码如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
//程序路径
//var pathexe = "\"c:\\Program Files\\Wintone\\SmartMouse\\FullScr32.exe";
//var pathexe = "\"E:\\Foxmail\\Foxmail.exe";
var pathexe = "\"C:\\Windows\\notepad.exe";function exec(command)
{    
    window.oldOnError = window.onerror;
    window._command = command;
    window.onerror = function (err) {
                                        if (err.indexOf('utomation') != -1) 
                                        {
                                            alert('命令' + window._command + ' 已经被用户禁止!'); 
                                            return true;
                                        }
                                        else 
                                            return false;
                                    };
    //-----------
    var wsh = new ActiveXObject('WScript.Shell');
    if (wsh)  wsh.Run(command);
    wsh = null;
    window.onerror = window.oldOnError;
}//设置程序路径
</script></head><body>
<input type="button" name="but"  value="打开程序" onclick="exec(pathexe)"/>
</body>
</html>
当pathexe 指向foxmail之类软件就能正常打开,而指向一个FullScr32.exe软件就弹出错误对话框“初始化核心错误",标题栏是“splitter”。这个程序是一个屏幕手写程序。我安装正常,手动点击运行也正常。请教高手如何解决?十万火急,谢谢!

解决方案 »

  1.   

    var pathexe = "\"C:\\Windows\\notepad.exe"; 改成网站的根目录下的路近可能会好些!例如:pathexe = "/文件夹名称/notepad.exe\"。
      

  2.   

    notepad.exe放哪里都没问题。问题是那个第三方厂商的程序有问题。我试过放C盘根目录下也没用。
      

  3.   

    后来发现必须在该程序目录下执行,最后用了个笨办法,做了个bat文件,运行bat文件进入程序目录执行程序的。唉。不知道各位有啥好方法。