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

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,

XWL
XWLAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PriyeshCommented:
you could change it in the registry. it should be under the key,

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\
    {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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AlexFMCommented:
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.
0
XWLAuthor Commented:
It works!

Thank you evry much, Privesh.  Thank you too, AlexFM.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.