AfxOleInit: multiple OLE references causing problems upon exiting app

I

intell1

Hi:

the following situation arises in my application (mfc 4.2, WinXP): the main
thread needs to call AfxOleInit() to enable drag&drop and other functions; a
worker thread also needs to call AfxOleInit() to enable Word automation,
which is its main function. (NOTE: the worker thread cannot launch MS-Word
unless an explicit call to AfxOleInit() is made).

The problem: upon exiting the application, the COleObjectFactory object
compains about two OLE references (m_dwRef = 2), since only one (or none) is
expected. The assertion is actually placed in the CCmdTarget (its parent
class) destructor.

When the worker thread is not executed, there is no problem. Also, under
Win2K, there is no problem even when the worker thread is executed.

Any information on this issue will be valuable.

TIA,
Nikolas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top