Failure when create connection from other thread 
Author Message
 Failure when create connection from other thread

I have a problem with ADO connections ...

When I try to create connection through ADO to database
through GUI thread of my dialog I don't have any problem.
The connections are properly created and I can use them.

But If I start new thread and delegate it creating of
connections then I received failed HRESULT from
I step into comip.h and I found that it result in errors
hr = CoCreateInstance(rclsid, pOuter, dwClsContext,
__uuidof(IUnknown), reinterpret_cast<void**>(&pIUnknown));

Can somebody give me advice what I should do?? And what
cause this problem? Thank you in advance!

Regards, Alex

Sun, 25 Dec 2005 00:02:53 GMT  
 Failure when create connection from other thread

Fri, 19 Jun 1992 00:00:00 GMT  
 Failure when create connection from other thread
I decided to look for the problem in google and there I
realized that COM must be initialized per thread. So I
call ::CoInitialize(NULL); in the begging of the thread
and every thing is going fine.


Sun, 25 Dec 2005 21:05:54 GMT  
 [ 3 post ] 

 Relevant Pages 

1. CAsyncSocket::Create() in thread causes assertion failure

2. Problem in creating ADO connection instance in thread

3. Suspending ONLY the thread at break point, keeping others running on VC++ 7.0

4. Network drive re-connection failure?

5. Atl 3.0 Connection points failure in win 2000/XP

6. Handling SQL Server connection failures

7. How to detect a NT connection failure?

8. Q: ODBC connection failure

9. Ftp failure over dial-up connection

10. Thread Management: Keeping Track of Created Threads

11. How do I create Apartment-threaded objects from a Both-threaded object

12. how do i create thread safe worker thread


Powered by phpBB® Forum Software