MULTITHREADED apartment and ActiveX controls

I use Visual C++ 6.0 SP2.
I have multihreaded DCOM client. DCOM I initialize by CoInitializeEx(NULL, COINIT_MULTITHREADED), beacause I have a few threads from which I call objects. But now I want use some ActiveX controls in dialogs. When I try it, DoModal tries call AfxOleInit. It fails and returns RPC_E_CHANGED_MODE.
What can I do?  Can I prevent AfxOleInit call?
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.

If you really want multithread then you will hit a number of problems with MFC as most of it assumes single threaded apartment. I got caught by this as well when m drag-drop would not work!.  One solution may to do call couninit before DoModal
knillAuthor Commented:
Are you sure, that it is good idea? Didn't I by CoUnitialize release all object references?
BTW: I already soved this problem. I have MTA with main message loop thread and STA with second message loop thread for all dialogs with ActiveX Controls.
All userinterface related stuff needs a message loop. And UI threads SHOULD be working in STA. More over ActiveX controls should also work in VB and all VB based clients work in STA.
 I guess, somewhere I had read that ActiveX controls always work in STA. Hence I guess you faced the problem because of the COINIT_MULTITHREADED flag..

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
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
System Programming

From novice to tech pro — start learning today.