473,836 Members | 1,543 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_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>

----------

Jul 23 '05 #1
2 5041

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.CreateO bject.
--

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
2689
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 able to run ActiveX control". So, the ActiveX control just show on the broswer, but not able to run it. I want to find a way to detect it. And prompt the user a message telling
9
5738
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 deepest visible element to the top. By carefully studying fromElement and toElement properties, one can handle events on any point of their way up. NN/FF implements a "Russian hills" style: mouse events go first up->down (window->deepest...
0
1720
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) Currently only an ActiveX control is available for WebForms, so I embedded it using the "<object>" tag.
0
1080
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 event,and then utilize the event's para to do more things. First ,I am not sure how much data can be exported by control event's para ? Second,I don't want to export large data by so many paras,such as largedataevent(para1,para2,para3,...... )
10
6026
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 code is in C#/ASP.NET. TIA. Andrew.
3
8370
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 ActiveX Exe, I just can't seem to catch the event. I've declared my object as follows: <OBJECT ID = "Test3" CODEBASE = "http://www.amys-attic.com/Test3.exe"
2
2829
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 ActiveX control we're using (GrFinger for fingerprint reader)implements several event handlers. It is also my understanding that there is no Message Pump within a Windows Service. I suppose I could create my own message pump, but this seems...
2
2949
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 level with WM_ messages, but almost beginner in .NET & C# environment, I don't see the solution, which is probably trivial for experienced people. Any help?
4
5632
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 capture in an aspx page. Where can i find information about it or how can i do this? Thanks a lot!!!
0
9668
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10844
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10590
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9374
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7791
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6979
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4016
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3113
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.