473,520 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript, new ActiveXObject() and events

Hello,
I have an ActiveX object with events, and I need to get notifications of
these events in javascript script on asp.net web page.
The mentioned above ActiveX is a standard ATL com object implementing event
interface:
dispinterface _MyEvents
{
properties:
methods:
[id(1), helpstring("method MyEvent")] void MyEvent([out]BSTR aData);
};

Is it possible to subscribe to that event when the object is dynamically
created with "var obj = new ActiveXObject("...")"? There's a lot of info
about events when object is embedded into the page, but I can't find any
decent info about events of dynamically created objects.

Thanks in advance for any help.
Aug 14 '07 #1
2 4020

"Alvin Bruney [MVP]" wrote:
<script for=myControl1 event="ClickEvent(a,b)" language="javascript">
function myControl1::ClickEvent(a,b)

{

alert('Events are firing in Internet Explorer with co-ordinate: ' + a);

}

</script>
That doesn't seem to work, as I have just a variable named MyObj but not an
object with ID="MyObj".

my javascript code:

var MyObj;

function PageLoad()
{
try
{
MyObj = new ActiveXObject("MyLib.MyObject");
MyObj.Open(1);
}
catch (e)
{
alert(e);
}
}

function PageUnLoad()
{
try
{
if (MyObj.IsActive)
{
ScanApp.Close();
}
MyObj = null;
}
catch (e)
{
alert(e);
}
}
So when I add "function MyObj::OnBarcodeRead(aBarcode){ alert(aBarcode); }"
the outcome is predictable "Error: Object expected".

What I need is a mechanism like Advise to bind a javascript function to COM
object event.


Aug 15 '07 #2
Well, it seems like there's no way of usingstandard events with the objects
created by "new ActiveXObject" technique.

It's still possible to call javascript methods from ActiveX using
IDispatch.Invoke supplied via ole object properties, f.e. like Microsoft
does in their XMLHTTP object. It does essentially what I wanted to do.
Aug 15 '07 #3

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

Similar topics

26
15172
by: Don | last post by:
I'm writing an html page with some JavaScript that reads a web page into a client-side temp file, then reformats it, then submits that same file as a URL to the browser for display, via "locate.replace". I can do all this if the html page containing the script originates on the client machine, but don't know how to get access to a...
3
8479
by: Roy Wang | last post by:
hi, My problem is how to determining when the XML file has loaded using javascript. I loaded an xml file using javascript in a web page. The code below is loading the xml file for IE: this.xmlDoc= new ActiveXObject("Microsoft.DomDocument"); this.xmlDoc.load(url);
6
1566
by: Steve B. | last post by:
Hello everybody In a webpage, I use JS display data from an xml file and a xsl file: var data = new ActiveXObject("Microsoft.XMLDOM"); data.async = false; var dataUrl = "data.aspx"; data.load(dataUrl) ; var transform = new ActiveXObject("Microsoft.XMLDOM"); transform.async = false ;
2
2080
by: catronro | last post by:
I want to read an xml file and build a string based on that file. But when i try to implement it i get an Object Required error. Any help would be greatly appreciated. try { var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); var html = ""; xmlDoc.load('siteMap.xml'); var xmlObj=xmlDoc.documentElement;
7
3191
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the column need to be a date picker field. I know things will be easier with ASPX datagrid.
90
10978
by: charlesmusco | last post by:
Hi all. I have the following problem. I have an xml file, while I will list below and I am trying to add nodes to the xml document based on user input to a form. The XML doc is ... <?xml version="1.0"?> <board> <message>
3
5602
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we want to give them the opportunity to run these modules from home as well, we are trying to get the USERNAME/COMPUTERNAME as well, so the students, when...
6
5577
by: shuttered | last post by:
Can anyone help me on this? I just need more information on all aspects of it. For example : how to add, delete, edit fields. Can i add new tables etc.. i know it is MS version of javascript so it only works in IE but thats perfect for my project and so is the clientside aspect of it as well, i know is easily hacked but I'm not worried about...
1
2709
by: critchey1 | last post by:
Hey everyone, i've been playing around with trying to get some scripts to work with detecting whether flash player is installed on your computer or not. I found a flash detection kit on the adobe site which had a client side detection method using javascript. Basically what im trying to get it to do is if flash player is installed, use the...
0
7326
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7238
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...
0
7470
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. ...
0
5769
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5159
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...
0
4809
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...
0
3298
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1683
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
531
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...

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.