?
Solved

Problem with multiple Instances of ActiveX Server

Posted on 1998-12-07
2
Medium Priority
?
194 Views
Last Modified: 2008-02-26
I have two executables.  Executable A has an User Interface and at the same time exposes an object to other applications.  A is configured as a standalone ActiveX exe and the class in A is configured to be MULTIUSE.  App B uses the object exposed by A.  App B also has an User Interface.

I use the two apps in the following way. I start App A first, then shell App B (with the Shell function)  from within App A. I use app A as a container for app B (A becomes the parent window for B). Then in App B I use the "set objxx as New clsAppA" statement to create an instance of the object and use it.  

The problem is...when I do this from the debug environment (running app A in IDE and shelling B as an Exe), I end up with two instances of App A.  It appears that when App B creates the object and uses it, this action  generates another instance of the App A server.  I thought that the "multiuse" selection on the class should prevent this from happening.  If I run the exe version of App A (running the compiled App A ) then I don't get the extra instance.  What's going on here and how do I fix it?

Any help would be appreciated
0
Comment
Question by:debbyt
[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: 1448666
Multiuse will mean what you expect only for ActiveX DLL project type. E.g. Loading("mydll.dll") will only increment its internal usage-counter. There will be only 1 dll in memory.

>I thought that the "multiuse" selection on the class should prevent ...
If it is EXE, of course you will be able to start many instances.

>how do I fix it?
What?
0
 
LVL 3

Accepted Solution

by:
covington earned 600 total points
ID: 1448667
MultiUse does not mean that your EXE server will only provide one instance of the object. It means that one instance of the running EXE will be used to provide multiple objects. If you set the property to SingleUse, then every 'Set xxx = new MyEXEServer' will launch a new copy of the EXE.

If you have it set as multiuse, but you want several instances of your class to be able to talk to each other, use global variables declared in regular modules. All classes will access the same copy of these variables.

It sounds like when you run A (IDE) and then launch B (EXE), and then B (EXE) launches A, B launches the compiled version of A to provide the object. Your description of 'two instances of A' is a little confusing, since you are always getting two instances of the class - just not two EXEs running.

If B is launching a compiled version of A when A is originally started from the IDE, check your project compatibility settings on A. It should be set to binary compatibility for the task that you want to accomplish. Also, after you have set this, check the references in B. The references in project B should be pointing to the compiled version of A. Now start A, but don't execute any code in B yet. Check the references in B. It should have automatically switched to the *.vbp of A. If this isn't happening, then binary compatibility isn't set up correctly.

Good luck. You are attempting to create crcular COM references. Although it's technically possible, it can be a real headache to develop & deploy. You'll really have trouble anytime you change the interface of A.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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

764 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