Solved

ActiveX Events caught in HTML document

Posted on 2000-03-01
1
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

734 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