When I try to create a instance of a COM class it throws an exception as
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Please suggest how could i solve it?
When I try to create a instance of a COM class it throws an exception as
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Please suggest how could i solve it?
By registering the class (specifically its CLSID) -- see e.g. here.
It looks like whichever program or process you're trying to initialize either isn't installed on your machine, has a damaged installation or needs to be registered.
Either install it, repair it (via Add/Remove Programs) or register it (via regsrv32.exe).
You haven't provided enough information for us to help you any more than this.
Also note that the class context when initializing can create that exception. If you have an object which is coded as INPROC_SERVER but you try to CoCreateInstance as CLSCTX_LOCAL_SERVER, you will also get that error.
You need to ensure the object is registered and the CoCreateInstance is creating an instance with the correct class context.