Solved

ActiveX Events caught in HTML document

Posted on 2000-03-01
1
218 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 clear a vector as well as how to detect empty vectors in C++.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now