Solved

MTS-friendly Components vs Simple Objects???

Posted on 2000-05-12
2
248 Views
Last Modified: 2010-08-05
CASE 1:I create a new VC++ project and make it MTS-friendly and then create my ATL's as MTS-components.
CASE 2: I create a new VC++ project without making it MTS-friendly and then create my ATL's as Simple Objects.

Question : What's the differences between the two? I've noticed the following in the MTS-friendly proj:

In the .dsp "ADDLINK 32...mtx.lib mtxguid.lib delayimp.lib...delayload:mtxex.dll"

In all of the .rgs the threadingmodel is set to 'Both'.

Are there any other differences?
Would it be possible to convert a non-MTS-friendly project to a friendly one just by making these changes or do I have to rewrite the whole thing?

A detailed answer is very much appreciated, thanks

Kattis
0
Comment
Question by:Kattis
2 Comments
 

Author Comment

by:Kattis
ID: 2813438
Adjusted points from 150 to 250
0
 
LVL 1

Accepted Solution

by:
kanejin earned 250 total points
ID: 2841380
Dear Kattis,

In ATL Wizard there are 2 places you can select MTS.

1. "Support MTS" in "AppWizard Step 1 of 1"
If you choose this option, the Appwizard will add mtx.lib, mtxguid.lib and delayimp.lib these static libraries to the project. You can find them in Project->Settings->Link. In addition, this option adds a reminder in the registration build step to run mtxrereg.exe before using the component in MTS. You can find this in Project->Settings->Custom Build. delayimp.lib is used to allow your project to Delay Load the mtxex.dll. Delay Load which is a new feature in VC6 allows you to specify a list of Dlls that will only be loaded when they are actually called. You may find a new link option "/delayload:mtxex.dll" in Project->Settings->Link.

2. "MS Transaction Server Component" in ATL Object Wizard
If you choose "MS Transaction Server Component" when you create a new object, "mtx.h" will be included.If you choose "Support IObjectControl", your object will implement IObjectControl(your object class will derive from IObjectControl).The following lines are added to the bottom of your class:

// IObjectControl
public:
STDMETHOD(Activate)();
STDMETHOD_(BOOL, CanBePooled)();
STDMETHOD_(void, Deactivate)();
CComPtr<IObjectContext> m_spObjectContext;

(Of course these methods' implementation code is added to the cpp file)
So you do not need rewrite the whole project. MTS component is also a com component.
Enjoy them.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now