?
Solved

VB6: ActiveX DLL events in a web page?

Posted on 2002-07-17
4
Medium Priority
?
289 Views
Last Modified: 2012-06-27
I've already asked this question, but it's not showing up in the Visual Basic Topic Area!  Arrg.  Anyway, here's a duplicate.  I hope this one shows up.

How can I respond to my objects events in a web page?  That is a very open ended question, so I'll be much more specific with an example below?

Create the text file "example.hta" and paste the following:

------------- example.hta start ---------------
<!-- frames -->
<html>
<head>
<HTA:APPLICATION
    ID="oMyApp"
    VERSION="1.0"
    CAPTION="yes"
    MAXIMIZEBUTTON="yes"
    MINIMIZEBUTTON="yes"
    SHOWINTASKBAR="yes"
    SINGLEINSTANCE="yes"
    SYSMENU="yes"
    VERSION="1.0"
    SCROLL="no">
    <title>Hello World Example</title>
    <script language="VBScript">
         Dim myVar
         set myVar = CreateObject("pjtHelloWorld.classHelloWorld")
         
         sub myVar_listenUP(theMessage)
              inComing.innerText = theMessage
         end sub
         
         sub saySomething()
              myVar.sayHello
         end sub
         
         sub getObjectVersion()
              versionNumber.innertext = myVar.getVersion
         end sub
    </script>
</head>
<body>
    <h1 onclick="getObjectVersion()">Hello World Program - The Beginning (version <span id=versionNumber></span>)</h1>
    <div id=inComing onclick="saySomething()">click me</div>
</body>
</html>
------------- example.hta end ---------------

Now, make a new project in VB 6.  Make it an Active-X Dll project.  Name your project "pjtHelloWorld" and name the class file "classHelloWorld".  Open the code window for your class and enter the following code:

------------- classHelloWorld code begin --------------
Public Event listenUp(ByVal message As String)

Public Property Get getVersion() As String
   getVersion = App.Major & "." & App.Minor & "." & App.Revision
End Property

Public Sub sayHello()
   RaiseEvent listenUp("Hello World")
End Sub
------------- classHelloWorld code end   --------------
Save your project.  Make pjtHelloWorld.dll.  Double-click example.hta to run it.

If you click on the title anywhere, you'll see the version number pop in.  The HelloWorld object is being instantiated, and the property is properly fetched when wanted.

Now click the text that says "click me".  Nothing happens.  Why?  I can't figure out how to respond to events that I raise from my active-x dll project in the web page.

Please alter my example such that you can respond to the events from the HTA for the points.

Thanks in advance for your help.

--lankford
0
Comment
Question by:lankford
[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
4 Comments
 

Author Comment

by:lankford
ID: 7162334
Well, I'm answering my own question here.  I don't see where I can delete my question anymore though.  Oh well.

If anyone is interested, it turns out that I couldn't find a way to do it with an ActiveX DLL.  Instead, I compiled my functionality into an ActiveX OCX control that has no visible interface.  This allows you to use an
object tag like the following:

<object
  id="myOCX"
  classid="CLSID:7A97D874-3CA6-4E1D-9F2A-70CB9119FB09"
  width="1"
  height="1">
</object>

Having this tag available when you load the page into the browser's memory allows it to hook the events together.  So, in my VBScript, I could respond to the event "myEvent" like so:

sub myOCX_myEvent(parameters)
     ' respond here
end sub

--lankford
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7169982
Ask to community support. You could PAQ instead of delete it.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8013796
lankford, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 8096158
Question placed in PAQ

Computer101
E-E Admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

800 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