Help! How to change threading model of an ATL Component interface after it is built?

Posted on 2003-03-27
Medium Priority
Last Modified: 2013-11-25
Hi there,

I have successfully built an ATL COM project and implemented several interfaces (VC++ 6.0 on Windows 2000/PK3). Unfortunately, when I am almost finished it, I found threading model of one of the interfaces must be changed from “Apartment” to “both” or “Free”.  Since the project has quite complicated cross-references, I don’t want to rebuild the project for the purpose.  I am wondering whether it is possible to change the threading model of an interface without rebuild it.  Could anybody give me an idea?

Thanks in advance,

Question by:XWL
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

Accepted Solution

Priyesh earned 1000 total points
ID: 8229202
you could change it in the registry. it should be under the key,

    {CLSID}\InprocServer32 = <path to 32-bit inproc server>
                       \ThreadingModel = <threading model>

when your current server is registered, it should be having the ThreadingModel key with value "Apartment". Edit it and change to "Both"or "Free". Should work fine.

Quick way to search and find the key will be to search for your xxx.dll in the registry.
LVL 48

Expert Comment

ID: 8232916
Create two new projects with the same names, create the same interface in each of them. Use Apartment in one case, Both or Free in another case. Run WinDiff to see the difference between projects. Make the same changes in your existing project.

Author Comment

ID: 8235192
It works!

Thank you evry much, Privesh.  Thank you too, AlexFM.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

752 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