它真的是一个ActiveX控件吗? [英] Is it REALLY an activex control?

查看:93
本文介绍了它真的是一个ActiveX控件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当简单的代码块。

  Sub Run(Name)
错误恢复下一个
设置objShell = CreateObject( WScript.Shell)
如果Err.Number = 429,则
alert(无效安全级别。)
退出子
如果结束
objShell.Run名称
如果Err.Number<> 0,然后
Alert(请验证您的操作系统选择)
如果
设置objShell = Nothing
End Sub


我将其与网站上的链接配合使用,以允许用户通过以下方式整理硬盘驱动器碎片:

 < a href =# onclick = Run('c:\\windows\\system32\\dfrgui.exe')> Defrag Windows Vista< / a> br; 
< a href =# onclick = Run('c:\\windows\\system32\\dfrg.msc')> Defrag Windows Server 2003 SE或Windows XP< ; / a>

您可能会猜到..使用:

 设置objShell = CreateObject( WScript.Shell)

正在引起一些问题,并引发错误,表明无法创建对象。我可以进入IE安全性并更改其安全设置,


初始化并编写未标记为安全的ActiveX
控件的脚本
脚本


到提示,它实际上会提示我并在我单击是时运行。



我的问题是;



由于这不是来自ASP服务器的单独代码块(htm没有任何代码的网页)。我真的需要花费20美元来对其进行签名吗,我该如何在htm页面的vbscript上首先做到这一点?



将要实施到DOES中的具有SSL证书。是否可以某种形式集成到现有证书中?



我要做的就是拥有类似于...的链接


如果要对计算机进行碎片整理,请
单击此处



如果要运行磁盘扫描,请单击此处


告诉我们所有的客户进入并更改其安全设置不是一种选择。

解决方案

您的代码不是问题。创建 WScript.Shell对象时,IE会询问该控件是否可以安全地进行脚本编写。该对象返回否。这就是为什么您的代码不起作用的原因。只要您使用 WScript.Shell,就会遇到问题。



一种解决方法是创建自己的ActiveX控件,该控件被标记为脚本安全 ,但随后您必须让所有用户进行安装。


I have a fairly simple block of code.

Sub Run(Name)
on error resume next
Set objShell = CreateObject("WScript.Shell")
if Err.Number = 429 then
    alert("Invalid Security Level.")
    exit sub
end if
objShell.Run Name
if Err.Number <> 0 then
    Alert("Please verify your Operating System Choice")
end if
Set objShell = Nothing 
End Sub

I'm using this with links on the website to allow the user to defrag their hard drive via:

<a href="#" onclick="Run('c:\\windows\\system32\\dfrgui.exe')">Defrag Windows Vista</a><br>
<a href="#" onclick="Run('c:\\windows\\system32\\dfrg.msc')">Defrag Windows Server 2003 SE or Windows XP</a>

As you can probably guess.. using:

Set objShell = CreateObject("WScript.Shell")

Is causing a bit of a problem, and it is throwing an error that the object cannot be created. I can go into IE security and change the security setting for,

"Initialize and script ActiveX controls not marked as safe for scripting"

to "Prompt", and it will actually prompt me and run when I click yes.

My question at this point is;

Since this is not a seperate block of code coming from an asp server (htm page w/ no code behind). Do I really need to spend $20 to get it signed, and how would I do that in the first place on a vbscript in an htm page?

Also.. the site that this will be implemented into DOES have an SSL cert. Is it possible to integrate into the existing cert in some way shape or form?

All I want to do is have links that are like...

"If you want to defrag your computer, click here"

"If you want to run a disk scan, click here"

And telling all our customers to go in and change their security settings is not an option.

解决方案

Your code isn't the problem. When you create the "WScript.Shell" object, IE asks that control if it is safe for scripting. The object returns "No". That's why your code doesn't work. As long as you use "WScript.Shell" you will have the problem.

One way around this is to create your own ActiveX control that is marked as "safe for scripting", but then you would have to get all of your users to install it.

这篇关于它真的是一个ActiveX控件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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