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

x
?
Solved

MTS-friendly Components vs Simple Objects???

Posted on 2000-05-12
2
Medium Priority
?
271 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 500 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 Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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.

721 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