Solved

ActiveX Events caught in HTML document

Posted on 2000-03-01
1
220 Views
Last Modified: 2010-04-10
I have created an ActiveX control for embedding in a HTML document using VC++.

The control is working well. My problem is that I wish to generate an event in the control which is caught by the browser/html page and activates a VBScript or Javascript function defined within that page.

Using the VC++ class wizard, i have created a custom event which is fired  by the control under certain circumstances.

How can i map this event to a VBScript of Javascript function?

I have tried using a standard ActiveX event (eg FireClick) and catching it with an <OBJECT> tag "onClick" property, but this does not seem to work.

Alternatively, is there a C++ function/method available to my ActiveX control which enables me to re-direct the browser to another URL (ala AppletContext functions in java).

please help!
many thanks,
Brendan.
0
Comment
Question by:mrpinko2
1 Comment
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 total points
ID: 2593968
You don't do it with the <OBJECT> statement, you do it like this:

<html>

<head>
<title>Test</title>
</head>
<object ID="Pinger" CLASSID="CLSID:DC458CF3-3ED8-11D2-84CE-0020AFEDCD49">
</object>

<body>

<p>Hello <BUTTON ID="test">Click me</BUTTON>

<script LANGUAGE="vbscript" FOR="test" EVENT="onclick">
<!--
      call window.alert("Trying to ping")
      Pinger.Ping
-->
</script>

<script
LANGUAGE="VBScript" FOR="pinger" EVENT="pong">
call window.alert(pong)
</script>

</p>

</body>
</html>

The PING object has an event called PONG. This web page catches the event using VBSCRIPT, but you can also use JSCRIPT.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question