Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

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

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…

581 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