Is it possible to use COM Object from DLL without register in C++ not managed code?
Yes, if it does not rely internally on other registered objects. Roman R. Roman R.
Click Start > All Programs > Accessories and right-click on "Command Prompt" and select "Run as Administrator" OR in the Search box, type CMD and when cmd.exe appears in your results, right-click on cmd.exe and select "Run as administrator" At the command prompt, enter: REGSVR32 "PATH TO THE DLL FILE"
Yes, if it does not rely internally on other registered objects.
LoadLibrary
the DLLGetProcAddress
its DllGetClassObject
DllGetClassObject
to obtain IClassFactory
pointer for CLSID
of interestIClassFactory::CreateInstance
and instantiate the coclassYou can create manifest files for the DLL and use Registration-Free COM.
Say, the COM DLL needs to be registered, but the application doesn't have admin access rights. Here is an easy hack to register the DLL under HKEY_CURRENT_USER
, which doesn't require admin rights:
LoadLibrary
to load the COM DLL.GetGetProcAddress
to get the address of DllRegisterServer
.RegOverridePredefKey
to make the temporary registry redirects: HKEY_LOCAL_MACHINE
to HKEY_CURRENT_USER
and HKEY_CLASSES_ROOT
to HKEY_CURRENT_USER\Software\Classes
.DllRegisterServer
obtained in step 2.HKEY_CURRENT_USER
.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