Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MTS and Global MultiUse

Posted on 2001-08-12
4
Medium Priority
?
388 Views
Last Modified: 2006-11-17
I have a nice errorhandler component which manages the error call stack. ie. When an error occurs, all error handlers use this component to return a nice new error description which is passed on thru the stack.

I'd like to make the component GlobalMultiUse so developers don't have to worry (or forget) about instantiating this component.

If I have a component designed to run under MTS, can I safely reference my new globalmultiuse error component.  

I have tried this and get a windows error when the MTS component times out.

Are there any tricks to this..?

(Sorry about the points, its all I have!!!)




0
Comment
Question by:misterben
  • 2
4 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 6378938
MTS takes care of creating and eliminating the component whenever it feels like. For example when the MTS machine runs out of memory, or when it hasn't been used for some time. That is the amin difference if you are using MTS, without MTS the component will run in-process and thus won't be destroyed until you request it to be destroyed.

You can try checking out the Activation tab in the properties of the components in MTS (I am using component services from windows 2000 so it might be named differently for you...)

regards,
CJ
0
 
LVL 6

Accepted Solution

by:
anthony_glenwright earned 225 total points
ID: 6379456
I had a global multiuse function (an error handler, just like you), and when we introduced MTS support, I just couldn't get it to work...

Eventually, I found this article, http://support.microsoft.com/support/kb/articles/Q241/8/96.ASP which contains "Do not use the GlobalMultiUse Instancing property for a class when you intend to use the ActiveX component under MTS or COM+. The interface for the GlobalMultiUse object is cached in a per thread-based table and is not freed until the thread terminates. As a result, if a call comes in with a different context (although on the same thread), it fails with RPC_E_WRONG_THREAD. To use components in MTS and COM+, you should design your classes in such a way that the objects are stateless. "
0
 

Author Comment

by:misterben
ID: 6379471
Thanks Anthony for the quick response.

0
 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6379482
No problem.  Good luck.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

972 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