Solved

MTS-friendly Components vs Simple Objects???

Posted on 2000-05-12
2
265 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
[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
 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

751 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