Solved

MTS-friendly Components vs Simple Objects???

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

Independent Software Vendors: 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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

617 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