“访问被拒绝"通过在 Windows XP x64 上使用 JScript 执行 .hta 文件 [英] "Access is denied" by executing .hta file with JScript on Windows XP x64

查看:25
本文介绍了“访问被拒绝"通过在 Windows XP x64 上使用 JScript 执行 .hta 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的 HTML(作为 HTA)应用程序,它在 Windows XP x64 机器上显示出奇怪的行为.我定期(不是每次)收到错误消息访问被拒绝".当我启动应用程序时.相同的应用程序在 Windows XP 32 位上运行得很好...

有人有什么想法或解释吗?

错误信息:

<前>线路:18字符:6错误:访问被拒绝.代码:0网址:file:///D:/test_j.hta

这是我的test_j.hta"的代码:

<头><title>测试J</title><HTA:应用ID="objTestJ"APPLICATIONNAME="TestJ"滚动=否"SINGLEINSTANCE="是"窗口状态=正常"><脚本语言="JScript">函数主(){//window.alert("test");window.resizeTo(500, 300);}函数 OnExit(){window.close();}<body onload="main()"><input type="button" value="Exit" name="Exit" onClick="OnExit()" title="Exit">

解决方案

尝试在启动代码周围添加 try catch

试试{window.resizeTo(500, 300);}赶上(e){}

或者尝试 setTimeout:-

setTimeout(function() {window.resizeTo(500, 300);}, 100);

I have a simple HTML (as HTA) application that shows strange behavior on Windows XP x64 machine. I getting periodically (not every time) error message "Access is denied." when I start the application. The same application on Windows XP 32bit runs just fine...

Does somebody has any idea or explanation?

Error message:

Line: 18
Char: 6
Error: Access is denied.
Code: 0
URL: file:///D:/test_j.hta

Here is the code of my "test_j.hta":

<html>

<head>
<title>Test J</title>

<HTA:APPLICATION 
     ID="objTestJ" 
     APPLICATIONNAME="TestJ"
     SCROLL="no"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
>

<script language="JScript">

function main()
{
     //window.alert("test");
     window.resizeTo(500, 300);        
}

function OnExit()
{
    window.close();
}

</script>

</head>

<body onload="main()">
     <input type="button" value="Exit" name="Exit" onClick="OnExit()" title="Exit">
</body>
</html>

解决方案

Try adding a try catch around the startup code

try
{ 
    window.resizeTo(500, 300); 
} catch(e) { }

Alternatively try setTimeout:-

setTimeout(function() {
    window.resizeTo(500, 300);
}, 100);

这篇关于“访问被拒绝"通过在 Windows XP x64 上使用 JScript 执行 .hta 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆