First-chance exception at 0x75669617 in BasicReport.exe: 0x800401F0: CoInitialize has not been called.
Warning: constructing COleException, scode = CO_E_NOTINITIALIZED ($800401F0).
First-chance exception at 0x75669617 in BasicReport.exe: Microsoft C++ exception: COleException at memory location 0x034bed94..
Unhandled exception at 0x75669617 in BasicReport.exe: Microsoft C++ exception: COleException at memory location 0x034bed94..
Can any1 explain to me what the problem is ? and how can i fix it
You need to call CoInitialize when your program starts and CoUnitialize when it terminates.
The best place to do this is in InitInstance and ExitInstance.
Just make CoInistialize the first call to InitInstance.
Code:
BOOL CBasicReportApp::InitInstance()
{
CoInitialize( NULL );
if(!AfxOleInit())
// etc.
}
For the CoUnitialize call, you need to override ExitInstance.
To do this, Open the Class view, select the CBasicReportApp class.
Right click and choose "Properties".
At the top of the properties window you'll see a series of icons.
One is a little lightning bolt, one looks like a small window, and one looks like a little green box. If you hover over these, you get a tooltip for each one. In order this will be "Events", "Messages", and "Overrides". Click on the Green Icon ("Overrides"),
Scroll down until you find ExitInstance and create an override for this method.
Well, that's how you normally do it. Looks like using CWinAppEx breaks that.
So enter it manually (and put a declaration in the header file too).
Code:
INT CBasicReportApp::ExitInstance()
{
CoUninitialize( );
return CWinAppEx::ExitInstance( );
}
i have followed ur help and add both CoInitialize, CoUnInitialize function into CBasicReportApp::InitInstance() and CBasicReportApp::ExitInstance() but till got the same problem
First-chance exception at 0x75669617 in BasicReport.exe: 0x800401F0: CoInitialize has not been called.
Warning: constructing COleException, scode = CO_E_NOTINITIALIZED ($800401F0).
First-chance exception at 0x75669617 in BasicReport.exe: Microsoft C++ exception: COleException at memory location 0x0259f13c..
Unhandled exception at 0x75669617 in BasicReport.exe: Microsoft C++ exception: COleException at memory location 0x0259f13c..
Yeah, I used Worker thread in my project.
I have att my project with this post
You can see my code there and please tell me what is the problems with my code.
Yeah, I used Worker thread in my project.
I have att my project with this post
You can see my code there and please tell me what is the problems with my code.
You'll need to put the CoInitialize/CoUnitialize pair into each thread where COM objects are called.
First-chance exception at 0x75669617 in BasicReport.exe: 0x8001010E: The application called an interface that was marshalled for a different thread.
Warning: constructing COleException, scode = RPC_E_WRONG_THREAD ($8001010E).
First-chance exception at 0x75669617 in BasicReport.exe: Microsoft C++ exception: COleException at memory location 0x038ef28c..
Unhandled exception at 0x75669617 in BasicReport.exe: Microsoft C++ exception: COleException at memory location 0x038ef28c.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.