Hi,
I'm confused why I can capture an event fired by an ActiveX object when
it's loaded via an <object> tag, but not when loaded using "new
ActiveXObject".
Here's a basic example:
vb ActiveX object:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwmilliseconds As Long)
Public MyProp As Integer
Public Event doPop()
Public Sub FireEvent()
Sleep (2000)
RaiseEvent doPop
MyProp = 3
End Sub
Private Sub Class_Initializ e()
MyProp = 1
End Sub
------------------------------------
javascript using the script to load the object:
(This way loads the object - I can get property values.
I just can't capture the event).
<html>
<script type="text/javascript">
var VBxSignaler
function loadTheObject()
{
try {
VBxSignaler = new ActiveXObject(' TestControl.VBx Signaler')
} catch (e) { alert( "oops" ); }
getProp();
}
function doAlert() { alert( "It caught the event" ); }
function fireTheAlert() { VBxSignaler.Fir eEvent(); }
function getProp() { alert( VBxSignaler.MyP rop ); }
</script>
<script type="text/javascript" for="VBxSignale r" event="doPop">
getProp();
</script>
<body onload="javascr ipt:loadTheObje ct();">
<input type=button id=button1
onclick="javasc ript:VBxSignale r.FireEvent();" value="Fire" /><p>
<p><input type=button id=button2 onclick="javasc ript:getProp(); "
value="Get new Val" /><p>
</body>
</html>
-------------
This is using the <object> tag.
This way allows me to capture the event.
Any help would really be appreciated.
<html>
<div style="display: none">
<object
id="VBxSignaler "
classid="CLSID: B84143D2-3ADB-48E1-9716-05B77BB982B5"
style="display: none;">
</object>
</div>
<script type="text/javascript" for="VBxSignale r" event="doPop">
alert( "I just caught the event!" );
</script>
<body>
<b>This contains the "object" tag</b><br>
<input type=button onclick="VBxSig naler.FireEvent ();" value="Fire"
/><p>
</body>
</html>
----------
I'm confused why I can capture an event fired by an ActiveX object when
it's loaded via an <object> tag, but not when loaded using "new
ActiveXObject".
Here's a basic example:
vb ActiveX object:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwmilliseconds As Long)
Public MyProp As Integer
Public Event doPop()
Public Sub FireEvent()
Sleep (2000)
RaiseEvent doPop
MyProp = 3
End Sub
Private Sub Class_Initializ e()
MyProp = 1
End Sub
------------------------------------
javascript using the script to load the object:
(This way loads the object - I can get property values.
I just can't capture the event).
<html>
<script type="text/javascript">
var VBxSignaler
function loadTheObject()
{
try {
VBxSignaler = new ActiveXObject(' TestControl.VBx Signaler')
} catch (e) { alert( "oops" ); }
getProp();
}
function doAlert() { alert( "It caught the event" ); }
function fireTheAlert() { VBxSignaler.Fir eEvent(); }
function getProp() { alert( VBxSignaler.MyP rop ); }
</script>
<script type="text/javascript" for="VBxSignale r" event="doPop">
getProp();
</script>
<body onload="javascr ipt:loadTheObje ct();">
<input type=button id=button1
onclick="javasc ript:VBxSignale r.FireEvent();" value="Fire" /><p>
<p><input type=button id=button2 onclick="javasc ript:getProp(); "
value="Get new Val" /><p>
</body>
</html>
-------------
This is using the <object> tag.
This way allows me to capture the event.
Any help would really be appreciated.
<html>
<div style="display: none">
<object
id="VBxSignaler "
classid="CLSID: B84143D2-3ADB-48E1-9716-05B77BB982B5"
style="display: none;">
</object>
</div>
<script type="text/javascript" for="VBxSignale r" event="doPop">
alert( "I just caught the event!" );
</script>
<body>
<b>This contains the "object" tag</b><br>
<input type=button onclick="VBxSig naler.FireEvent ();" value="Fire"
/><p>
</body>
</html>
----------
Comment