Problem with (many, many) registry traversal suggestions:
- There are several registry keys that you will need to look for
- a class can be registered and does not exist in the registry
Without registration, COM allows you to get a class without registration. Conceptually, you donβt want to know if a class is registered, you just want to know that it is registered enough to create.
Unfortunately, the only (and best) way to do this is to create it:
//Code released into public domain. No attribution required. function IsClassRegistered(const ClassID: TGUID): Boolean; var unk: IUnknown; hr: HRESULT; begin hr := CoCreateInstance(ClassID, nil, CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER, IUnknown, {out}unk); unk := nil; Result := (hr <> REGDB_E_CLASSNOTREG); end;
Ian boyd
source share