Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Multiple instance of an activeX EXE

Posted on 2001-07-12
4
Medium Priority
?
470 Views
Last Modified: 2008-02-01
I created an activeX EXE composed of a class ClassA. This activeX is used by the applications appA and appB.
When I load the applications appA and appB they use the same instance of the activeX. And, when I stopp the application appB, it unloads the instance of the ActiveX. But like this instance is unique, the application appA (that is still loaded) is not able to work with the class of the ActiveX.

What I would like to know, it is how to load the ActiveX in the applications appA and appB so that they never use the same instance of the activeX EXE.
Either, how the ActiveX, when it is loaded could detect that there is already an other instance and how the ActiveX could create himself a second instance, independent of the first. And in this case, how unload the instance with which I work and not all instances.


any help welcome
thanks
0
Comment
Question by:Lemartna
[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
4 Comments
 
LVL 3

Accepted Solution

by:
jrspano earned 300 total points
ID: 6276893
go in the project properties and set the threading to thread per object.  each program will get a new instance of the active x exe
0
 
LVL 3

Expert Comment

by:jrspano
ID: 6276900
this will also take care of the unloading problem.  each exe will only unload the instance of the active x exe they have and not all of them
0
 
LVL 7

Expert Comment

by:Z_Beeblebrox
ID: 6277026
Hi,

The reason it unloads it probably because you have your class set to multiuse. Set it to 3-singleuse, then each instance will use a separate class.

Zaphod.
0
 
LVL 4

Expert Comment

by:WolfgangKoenig
ID: 6277067
You can do this with a connector class:
----------------------------------------
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Connector"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Member0" ,"RequestHandler"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"

Option Explicit

Public Property Get RequestHandler() As RequestHandler
  Set RequestHandler = gRequestHandler
End Property

Private Sub Class_Initialize()
  If gRequestHandler Is Nothing Then
    Set gRequestHandler = New RequestHandler
  End If
   
  clientCounter = clientCounter + 1
End Sub

Private Sub Class_Terminate()
  clientCounter = clientCounter - 1
  If clientCounter = 0 Then
    Set gRequestHandler = Nothing
  End If
End Sub

This you must add to your ActiveX EXE in a global
code modul:
Public gRequestHandler As RequestHandler

The object gRequestHandler guaranties that only one
instance of your AxtiveX exe is running at the same time.
The client must create a connector object, to access
the your ActiveX class with:
Set ClientActiveXRef = ClientConnector.RequestHandler

Therefore the ActiveX Exe is unloaded when the last
connector object is released ...
The idea for this is form microsoft ...

Best regards
WoK
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 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…
Suggested Courses

670 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