1.在VC6.0下生成和测试OCX控件
参阅 http://blog.csdn.net/chinamming/article/details/9277819
2.在JS下测试OCX控件
<html>
<head>
<title>ActiveX控件Demo</title>
<OBJECT id='L' classid='CLSID:63A27628-8A1A-4019-8A3E-EED8378918C2' width='100' height='100' codeBase="ReaderOCX.ocx" ></OBJECT>
</head>
<body>
<input id="Button1" type="button" value="执行函数" οnclick="javascript:RunFunc();" />
<hr color="blue">
</body>
</html>
<script language="javascript">
<!--
function RunFunc()
{
var lNum = L.ReadSztID();
alert("init:"+lNum);
}
// -->
</script>
<script language="javascript" for="L" event="TestEvent(strInfo)">
<!--
alert("响应事件的第1种方法: "+strInfo);
// -->
</script>
<script language="javascript">
<!--
function Hi(strInfo)
{
alert("响应事件的第2种方法: "+strInfo);
}
// -->
</script>
<script language="vbscript">
<!--
sub L_TestEvent(strInfo)
Hi(strInfo)
end sub
// -->
</script>
<script language="javascript">
<!--
function L::TestEvent(strInfo)
{
alert("响应事件的第3种方法: "+strInfo);
}
// -->
</script>
3.注册控件
regsvr32 xxxx.ocx
4.注销控件
regsvr32/u xxxx.ocx