how to register dll or ocx file via c++ code
-
Hello, Does anyone know how to register a dll or ocx file using c++ code (in particular I'm using vc++ 2008 standard)? I need it to work for Vista and Windows 7. Thanks!
It's a three step process: - LoadLibrary to get the DLL into memory - GetProcAddress to get the address of the function DllRegisterServer - Call DllRegisterServer through the pointer from GetProcAddress. Or you can just link with the DLL normally and call DllRegisterServer by name. Cheers, Ash
-
Hello, Does anyone know how to register a dll or ocx file using c++ code (in particular I'm using vc++ 2008 standard)? I need it to work for Vista and Windows 7. Thanks!
See DLLRegisterServer()[^]
Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010Current training method: HIT
-
It's a three step process: - LoadLibrary to get the DLL into memory - GetProcAddress to get the address of the function DllRegisterServer - Call DllRegisterServer through the pointer from GetProcAddress. Or you can just link with the DLL normally and call DllRegisterServer by name. Cheers, Ash
-
Thanks Ash, Will this work on Vista and Windows 7 with them having the extra security features?
I think so, I've done it successfully on both of them. There might have to be some fancy footwork on Vista but if there is my mind's a blank. Oh, I was using it from a setup program which was running elevated under Vista and Windows 7 - which might be a problem. Cheers, Ash
-
See DLLRegisterServer()[^]
Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010Current training method: HIT
-
I think so, I've done it successfully on both of them. There might have to be some fancy footwork on Vista but if there is my mind's a blank. Oh, I was using it from a setup program which was running elevated under Vista and Windows 7 - which might be a problem. Cheers, Ash
Registering a DLL/OCX involves modifying the registry which means elevated privileges. You can either always remember to run the registering application as administrator (Right click -> Run as administrator). Or you can instruct the application to always run elevated -
Project -> Properties -> Configuration Properties -> Linker -> Manifest File -> UAC Execution Level -> requireAdministrator
.«_Superman_»
I love work. It gives me something to do between weekends. -
OCX can be embedded in a binary, but this is not an alternate solution. To use the OCX you will have to extract it from the binary and register it.
«_Superman_»
I love work. It gives me something to do between weekends. -
Hello, Does anyone know how to register a dll or ocx file using c++ code (in particular I'm using vc++ 2008 standard)? I need it to work for Vista and Windows 7. Thanks!
Following article on Reg-Free COM might be a good read: http://msdn.microsoft.com/en-us/magazine/cc188708.aspx[^]
-
Hello, Does anyone know how to register a dll or ocx file using c++ code (in particular I'm using vc++ 2008 standard)? I need it to work for Vista and Windows 7. Thanks!
ocx control can register with "regsvr32". ther is 3 possiable solution 1. you can put command in command prompt regsrvr32 OcxFilePath or 2. Make batch file and open with c code. batch file contain data regsrvr32 OcxFilePath or 3. open a process with c code with command line argument regsrvr32 OcxFilePath
-
It's a three step process: - LoadLibrary to get the DLL into memory - GetProcAddress to get the address of the function DllRegisterServer - Call DllRegisterServer through the pointer from GetProcAddress. Or you can just link with the DLL normally and call DllRegisterServer by name. Cheers, Ash
-
You're partly right as the original poster mentioned ocxs, mea culpa! However you don't have to initialise COM to load up a DLL and call an exported function on it. You can (conceptually) easily register most COM DLLs by writing to the registry directly - if you know all the details of the objects you're registering (GUIDs of the CoClasses and IIDs of the CoInterfaces). Have a look in "Essential COM" by Don Box for a script based
DllRegisterServer
that doesn't require COM to be initialised. ActiveX controls may be an exception but they're out of my experience. If that's the case, as they implement OLE interfaces, you needOleInitialise()
before registering and NOTCoInitialize()
. Cheers, Ash -
You're partly right as the original poster mentioned ocxs, mea culpa! However you don't have to initialise COM to load up a DLL and call an exported function on it. You can (conceptually) easily register most COM DLLs by writing to the registry directly - if you know all the details of the objects you're registering (GUIDs of the CoClasses and IIDs of the CoInterfaces). Have a look in "Essential COM" by Don Box for a script based
DllRegisterServer
that doesn't require COM to be initialised. ActiveX controls may be an exception but they're out of my experience. If that's the case, as they implement OLE interfaces, you needOleInitialise()
before registering and NOTCoInitialize()
. Cheers, AshI've read "Essential COM". In the case of the script bases registration code (I can't remember it explicitly) the script runtime almost certainly initialises COM (so it's already done). I understand that
LoadLibrary
and friends don't require COM, but that's hardly the point. The point is the runtime environment the registration code is allowed to assume.Steve
-
I've read "Essential COM". In the case of the script bases registration code (I can't remember it explicitly) the script runtime almost certainly initialises COM (so it's already done). I understand that
LoadLibrary
and friends don't require COM, but that's hardly the point. The point is the runtime environment the registration code is allowed to assume.Steve