JavaScript调用OCX函数()/含参【转】
红色字体为需要添加的代码!
在头文件 *.h 文件下声明方法:
afx_msg void Circle_Play(LPCTSTR CirWind, LPCTSTR CirUrl);
 afx_msg void Circle_Stop();
再在 *.cpp文件下添加:
BEGIN_DISPATCH_MAP(CVideoStreamCtrl, COleControl)
       
DISP_FUNCTION(CVideoStreamCtrl, "Circle_Play", Circle_Play, VT_EMPTY, VTS_BSTR VTS_BSTR)
       DISP_FUNCTION(CVideoStreamCtrl, "Circle_Stop", Circle_Stop, VT_EMPTY, VTS_NONE)

 DISP_FUNCTION_ID(CVideoStreamCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
END_DISPATCH_MAP()
void CVideoStreamCtrl::Circle_Play(LPCTSTR CirWind, LPCTSTR CirUrl)
{}
void CVideoStreamCtrl::Circle_Stop()
{}
///////////////////////html代码
<HTML>
<BODY>
<OBJECT
 ID="VideoStream"
 WIDTH=850
 HEIGHT=560
 CLASSID="CLSID:24E30FC0-E999-4DFD-90A0-3162C74FC031">
    <PARAM NAME="ServerIp" VALUE="10.0.16.24">
    <PARAM NAME="ServerPort" VALUE="554">
    <PARAM NAME="SubChannel" VALUE="0">
    <PARAM NAME="URLValues" VALUE="10.0.16.67,8000,admin,12345,0.1.2.3;10.0.9.2,8000,admin,12345,">
 <PARAM NAME="DVRPort" VALUE="8000">
 <PARAM NAME="Username" VALUE="admin">
 <PARAM NAME="Password" VALUE="12345">
</OBJECT>
<SCRIPT LANGUAGE="Javascript" type = "text/javascript">
function Play()
{
    VideoStream.Circle_Play("4","10.0.9.2,8000,admin,12345,0.1.2.3");
}
function Close()
{
    VideoStream.Circle_Stop();
}
</SCRIPT>
<FORM>
<INPUT NAME="PLAY" TYPE="BUTTON" VALUE="Play" onClick="Play()">
<INPUT NAME="STOP" TYPE="BUTTON" VALUE="STOP" onClick="Close()">
</FORM>
</BODY>
</HTML>
阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

JavaScript调用OCX函数()/含参【转】

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭