Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / December 2004

Tip: Looking for answers? Try searching our database.

urgent /clr & COM Thread Mode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RNEELY - 02 Dec 2004 19:11 GMT
I am trying use CLR from an old VC6 MFC app that was ported to the VC7
compiler.  Initially the app worked fine.  However, after I enabled /clr in
the project
settings and ran the app, all calls to AfxOleInit(), OleInitialize() and
Coinitialize() fail with hr=0x80010106.  Error lookup shows this error as:
"Cannot change thread mode after it is set."

It seems to me that this error could only occur if a thread mode were alreay
set.  Therefore the CLR must have already called CoInitializeEx() with
COINIT_MULTITHREADED by the time my MFC app got around to calling
AfxOleInit().  So I tried commenting out my app's call to AfxOleInit().  Then
the app failed the same way in other spots.  For instance, the app uses DAO
which apparently calls CoInitialize() from line 5665 in daocore.cpp.  
Commenting out OLE/COM inititialization calls does not seem the correct way
to fix this problem.  I can't and don't want to modify daocore.cpp.  

Is there any other way to resolve this problem?  Perhaps some way to
instruct the CLR to COINIT_APARTMENTTHREADED?  Can anyone help?

Your help would be much appreciated.

Signature

Regards,
-Ron

RNEELY - 03 Dec 2004 16:55 GMT
This thread was resolved via code guru
http://www.codeproject.com/script/comments/forums.asp?forumid=3785&df=4&mpp=50&s
elect=987044&msg=987044#xx987044xx


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.