ntsue
ntsue

Reputation: 2395

How to catch COM object exception?

I get the error:

COM object with CLSID {88578679-272B-40C0-B1FD-C3409381A450} is either not valid or not registered.

And I know it is because I need to register my DLL using regsvr32. I was wondering if I can catch the exception for this error, so that I can log to the user to use regsvr32 to register the DLL's.

Or must I simply catch all the exceptions?

Upvotes: 0

Views: 1347

Answers (1)

D Stanley
D Stanley

Reputation: 152521

catch(COMException comEx)
{
   // do something
}

Although that's not the only reason a COMException may be thrown, so you may be chasing red herrings if you assume that the problem is always that the class is not registered.

Upvotes: 2

Related Questions