I currently have code such as this
IAcctMaintPtr acct(__uuidof(AcctMaint));
acct->GetAccountList(q);
Now this code requires an external application to be running otherwise after the first statement I get an exception stating
Unhandled exception at 0x7739c41f (KernelBase.dll) in myapp.exe: Microsoft C++ exception: _com_error at memory location 0x003ccefc..
I tried to catch( const std::exception& )
but that doesn't seem to work - the exception is not being caught.
Any suggestion on how I could catch this exception ?
_com_error does not derive from std::exception, but you can catch it explicitly:
try {
IAcctMaintPtr acct(__uuidof(AcctMaint));
acct->GetAccountList(q);
} catch (_com_error& x) {
// Handle error in 'x'...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With