Skipping the COM registry by calling DllGetClassObject yourself
2015-09-30 16:07 DllGetClassObject [permalink]
Yey! For the first time ever I created a COM object from the DLL, skipping the COM registry. (Should have done this much, much sooner!) Why, you ask? Just to be sure you're using the correct DLL, and that the registry is not (ab)used to divert it to another DLL. And also this way in some cases you can avoid having to get administrative privileges at some point just to get that COM registration into the Windows registry...
T_DGCO=function(const CLSID, IID: TGUID; var Obj): HResult; stdcall;//DllGetClassObject
x:IMyObject;//replace by an interface of choice
if (p=nil) or (p(CLASS_MyObject,IClassFactory,f)<>S_OK) then
if f.CreateInstance(nil,IMyObject,x)<>S_OK then
x.Hello('World');//or whatever your object does