473,498 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ActiveX event capture question

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_Initialize()
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.VBxSignaler')
} catch (e) { alert( "oops" ); }
getProp();
}

function doAlert() { alert( "It caught the event" ); }
function fireTheAlert() { VBxSignaler.FireEvent(); }
function getProp() { alert( VBxSignaler.MyProp ); }
</script>

<script type="text/javascript" for="VBxSignaler" event="doPop">
getProp();
</script>

<body onload="javascript:loadTheObject();">

<input type=button id=button1
onclick="javascript:VBxSignaler.FireEvent();" value="Fire" /><p>

<p><input type=button id=button2 onclick="javascript: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="VBxSignaler" event="doPop">
alert( "I just caught the event!" );
</script>

<body>
<b>This contains the "object" tag</b><br>
<input type=button onclick="VBxSignaler.FireEvent();" value="Fire"
/><p>
</body>
</html>

----------

Jul 23 '05 #1
2 4992

jv***@yahoo.com wrote:
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".


You might want to ask the experts in the MS scripting newsgroups but
ActiveXObject does not provide event binding as you have found out.
For instance when you use JScript in WSH (Windows Script Host) scripts
you do not use ActiveXObject to have events bound but you need to use
WScript.CreateObject.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Thanks Martin. Good thought... also always nice to find out I'm not
just losing my mind.

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2680
by: SiuLoBow | last post by:
Hi, Is there anyway to detect the ActiveX control is able to run on the browser or not? After I installed the ActiveX control to my system, user sometimes switch the secruity setting to "not...
9
5717
by: VK | last post by:
My original idea of two trains, however pictural it was, appeared to be wrong. The truth seems to be even more chaotic. IE implements its standard down-up model: any mouse event goes from the...
0
1703
by: Kunal | last post by:
Hi all, I have run into a problem that I can't quite figure out. Here is the situation: I have to capture a signature from a WebForm. (The ASP.NET application is running on a TabletPC) ...
0
1060
by: 詹亚军 | last post by:
can activex control export large data to container by event's para ? I develop a activex control,and want to export large data to container(IE),web page can use javascript to capture the...
10
5995
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My...
3
8343
by: Chad Johnson | last post by:
I know this question has been asked a million times but I still can't get an event from an embedded ActiveX Exe to be caught in javascript. I am able to access all the properties and methods of the...
2
2811
by: =?Utf-8?B?Sm9obiBG?= | last post by:
Hello All, I have a question about using an ActiveX control with a Windows Servce in C#. I believe it is not possible to properly setup an ActiveX control in a windows service as the particular...
2
2933
by: P. Meyer | last post by:
Hi I need to capture a mouse click event when inside a visual third party ActiveX which unfortunately comes without published events. In Win32 I used to manage such problems on Application...
4
5595
by: =?iso-8859-1?Q?Mario_Cer=F3n_Charry?= | last post by:
i'm building a web app for capture fingerprints with a suprema SFR300 sensor. The sdk is not an activex, is a dll and wrappers in .NET for access dll. I need to build an activex that enable the...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7004
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7167
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4593
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
657
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
292
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.