描述:
我写了一个COM,如果添加在IE的上下文菜单中,则选择该菜单后可以正常调用。
autopull.htm
<script language="VBScript">
Sub AutoPull()
On Error Resume Next
set ic_opr=CreateObject("IC_OCX.IC_Opr")
if err<>0 then
MsgBox("IC_IO not properly installed!"+ vbCrLf+"Please Install URLAngel again")
else
ic_opr.DeviceID = 2
ic_opr.Port = 1
ic_opr.AutoPull
end if
end Sub
call AutoPull()
</script>
但是我在网页的脚本中直接调用,则提示ActiveX 部件无法创建对象:
pull.htm
<html>
<head>
<title>自动弹卡</title>
<meta http-equiv="Content-Type" c/html; charset=gb2312">
</head>
<script language="VBScript">
Sub AutoPull()
Err.Clear
On Error Resume Next
MsgBox("初使化IC_IO")
set ic_opr=CreateObject("IC_OCX.IC_Opr")
if Err.Number<>0 then
MsgBox("IC_IO not properly installed!"+ vbCrLf+"Please Install IC_IO again"+vbCrLf)
MsgBox("错误代码:" + Err.Source)
MsgBox("错误代码:" + CStr(Err.Number))
else
MsgBox("IC_IO installed!")
ic_opr.DeviceID = 2
ic_opr.Port = 1
ic_opr.AutoPull
end if
end Sub
</script>
<body bgcolor="#FFFFFF" text="#000000">
<a href="javascript:Autopull()">弹卡</a>
<form name="form1" method="post" action="">
<input type="button" name="btnAutoPull" value="自动弹卡" />
</form>
</body>
</html>
请高手看看。