创建对象WMPlayer.OCX问题 [英] Create object WMPlayer.OCX issue
本文介绍了创建对象WMPlayer.OCX问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在HTML页面中使用以下代码,但它返回NULL。 (IE8,MS WIndows 7 Pro)
I am using following code in my HTML page but it is returning NULL. (IE8 , MS WIndows 7 Pro)
Set Sound = CreateObject("WMPlayer.OCX")
我确信Windows Media Player已安装且工作正常。
I am sure Windows Media Player is installed and working fine.
如何修复它?
推荐答案
似乎不可能像我在HTML中使用的那样使用Visual Basic代码。
It seems like is impossible to use Visual Basic code like I use in HTML.
我们不得不在DOM中使用Windows Media Player
Instead of it we have to use Windows Media Player in DOM like this
<body onload='' scroll="no">
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="WindowsMediaPlayer"
width="0" height="0">
</object>
稍后我们必须实施所有方法来启动/停止音频/电影。
And later we must implement all methdos to Start/Stop audio/movie.
例如
<script type="text/vbscript" language="VBScript">
Set oElm = document.getElementById("WindowsMediaPlayer")
if oElm Is Nothing then
' MsgBox("element does not exist")
else
' MsgBox("element exists")
' MsgBox oElm
oElm.controls.stop()
oElm.URL = "C:\HTML\Sounds\oos.wav"
end if
<script>
这篇关于创建对象WMPlayer.OCX问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文