COM interface function calling problem using different thread
Hi,
I wrote an application using Google COM api. I wrote a class (name
CGoogleEarthCtrl) for initialize COM interfaces and calling all COM
functions. CGoogleEarthCtrl class implemented on Single-ton design. I
used successfully this rapper class in my application. I faced problem
when I created a thread, take instance of the CGoogleEarthCtrl class and
call COM function using CGoogleEarthCtrl instance. Initially application
gave me exception, "CoInitialize function not called", but why? I called
CoInitialize function in rapper class. After call CoInitialize(NULL)
function in thread, application gave exception on COM function calling,
Unhandled exception at 0x7c812a5b in GeotelWithGE.exe: Microsoft C++
exception: _com_error at memory location 0x0123f8ec..
and statement of exception,
The application called an interface that was marshalled for a different
thread.
Please guide where I am doing mistake? why marshaling problem is coming?
what I do to fix this problem?
I placed try-catch block around COM function but application is not
catching exception in catch block but vs2k5 open "googleearth.tli" file.
why my application is not catching exception?
"googleearth.tli" file code
inline HRESULT IApplicationGE::SetCameraParams ( double lat, double lon,
double alt, AltitudeModeGE altMode, double Range, double Tilt, double
Azimuth, double speed ) {
HRESULT _hr = raw_SetCameraParams(lat, lon, alt, altMode, Range,
Tilt, Azimuth, speed);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}
my application is not catching exception cause of no throw statement on
library. right?
Regards,
-aimslife
..