Solved

Global Variables for ActiveX Documents

Posted on 1999-01-06
2
294 Views
Last Modified: 2011-09-20
Hi, I am creating some ActiveX Documents for IE3.02 and 4.x, and I created them all in a single project file (ActiveX EXE). I have also some variables declared Global with a default value in a module file.

What I wanted is: when I change the values of these global variables in, say document A, I need these new values to be accessible by other documents. What I did was, when I click a "Next" button on Document A, which has a Hyperlink.NavigateTo "a html with Document B embedded", the global value remains the default on Document B even though Document A has changed it one step before.

Pls help! Thanks.
0
Comment
Question by:totoro030898
[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
2 Comments
 
LVL 15

Expert Comment

by:ameba
ID: 1454458
1. If you start your ActiveX EXE 3 times, each instance has its own independent global variables. One way to share variable values is via registry or your own ini or log file.

2. It is easier if you have *only one* instance of ActiveX EXE running and creating all objects. Then each object can access all global variables directly.

3. You can add ActiveX DLL to your ActiveX EXE project references.
Start new ActiveX DLL. Class1 is created by default. Paste this to your Class1:
Option Explicit

Public Property Get GlobalVar() As String
    GlobalVar = gGlobalVar
End Property

Public Property Let GlobalVar(ByVal sNewValue As String)
    gGlobalVar = sNewValue
End Property

Add module to your project. Paste this 2 lines to module1:
Option Explicit
Public gGlobalVar As String

Create dll (project1.dll)

In your ActiveX EXE (or Standard EXE) add reference to project1.dll
To access Global variable, use:
   Dim x As New Project1.Class1
   MsgBox x.GlobalVar ' get variable
   x.GlobalVar = "Document X" ' set variable

Each of your 3 EXEs will create its own x object. But, only 1 DLL will be loaded. Its usage count will be 3.
--
Maybe solution 1. is the simplest
0
 

Accepted Solution

by:
Ajoy earned 100 total points
ID: 1454459
totoro,
I am submitting this as an answer though i think part of the answer has already been given by 'ameba'.

You can have a Dll with a single class module with as many number of properties as your global variables. In ur 'ActiveX Document A' create an object of this class and whenever u change the values of the global variables, assign it to the object properties accordingly.
On the Click of the 'Next' button in 'document A' pass this object as a reference to 'Document b'. Then assign to the global variables in 'Document b' the property values of this object.
This will make  the global variables in 'document b' to have the new values.
This should solve ur problem.
u can contact me at
Ajoy.tarafder@in.bosch.com
regards,
Ajoy
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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month7 days, 10 hours left to enroll

632 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