[从 Windows 7 开始,Microsoft 代理已弃用,可能在后续版本的 Windows 中不可用。]
VBScript 是 Microsoft Internet Explorer 随附的一种编程语言。 对于其他浏览器,请与供应商联系以获取支持。 建议将 VBScript 2.0 (或更高版本) 与 代理一起使用。 尽管早期版本的 VBScript 可能适用于代理,但它们缺少你可能要使用的某些函数。 可以在 Microsoft 下载站点和 Microsoft VBScript 站点下载 VBScript 2.0 并获取有关 VBScript 的详细信息。
若要从 VBScript 对 Microsoft 代理进行编程,请使用 HTML
尽管 Microsoft Internet Explorer 支持后一种语法,但并非所有浏览器都支持。 为了兼容,请仅对事件使用以前的语法。
使用 VBScript (2.0 或更高版本) ,可以通过尝试创建 对象并检查它是否存在来验证 Microsoft 代理是否已安装。 以下示例演示了如何在不触发 (控件自动下载控件的情况下为代理控件检查,就像在页面上) 中包含<控件的 OBJECT> 标记时一样:
If HaveAgent() Then
'Microsoft Agent control was found.
document.write "
Found
"Else
'Microsoft Agent control was not found.
document.write "
Not Found
"End If
Function HaveAgent()
' This procedure attempts to create an Agent Control object.
' If it succeeds, it returns True.
' This means the control is available on the client.
' If it fails, it returns False.
' This means the control hasn't been installed on the client.
Dim agent
HaveAgent = False
On Error Resume Next
Set agent = CreateObject("Agent.Control.1")
HaveAgent = IsObject(agent)
End Function