How to Register an ActiveX DLL using regsvr32
(Also see the ActiveX DLL Registration Tutorial)
The first step is to determine if you need to register the ActiveX DLL compiled for 32-bit or 64-bit. If your computer is 32-bit, the choice is obviously 32-bit. Let’s start with it:
How to Register a 32-bit DLL on a 32-bit Windows operating system
- Using a text editor, create a .bat file in the same directory as the 32-bit DLL.
- Insert this line in the .bat file:
regsvr32 "%CD%"\myActiveX.dll
- Run the .bat “as Administrator”. regsvr32 will be trying to create entries in the Windows registry, so it may need administrative privileges.* On Windows 7, open an Administrator command prompt by going to the Start Menu, enter “cmd” in the search box and instead of pressing Enter, press Ctrl+Shift+Enter. Change directories to where the DLL’s and the batch script are located, and run the registration batch file from there.
regsvr32 on 64-bit Windows
If the computer is 64-bit Windows, it’s possible you still may need the 32-bit DLL. It depends on whether your application runs as a 32-bit process or a 64-bit process. If using the ActiveX from ASP, check to see if IIS is running in 32-bit mode or 64-bit mode. If 32-bit, the 32-bit ActiveX needs to be registered. Likewise, if IIS is running in 64-bit mode, register the 64-bit ActiveX DLL. For VB6 apps, it will always be 32-bit because VB6 is older and there is no such thing as a 64-bit VB6 app. This may also apply to older versions of other programming languages such as Delphi, FoxPro, etc.
If you are unsure, there is no harm in downloading and registering both 32-bit and 64-bit DLLs. 64-bit Windows has separate registries for 32-bit and 64-bit, so both may be registered.
How to Register a 32-bit DLL on a 64-bit Windows operating system
- Using a text editor, create a .bat file in the same directory as the 32-bit DLL.
- Insert this line in the .bat file:
\windows\syswow64\regsvr32 "%CD%"\my_32_bit_ActiveX.dll
It is the 32-bit version of regsvr32 that must be used to register the DLL in the 32-bit registry. We use the full path to regsvr32 to make sure we’re running the 32-bit version.
- Run the .bat “as Administrator”.* On Windows 7, open an Administrator command prompt by going to the Start Menu, enter “cmd” in the search box and instead of pressing Enter, press Ctrl+Shift+Enter. Change directories to where the DLL’s and the batch script are located, and run the registration batch file from there.
How to Register a 64-bit DLL on a 64-bit Windows operating system
- Using a text editor, create a .bat file in the same directory as the 64-bit DLL.
- Insert this line in the .bat file:
\windows\system32\regsvr32 "%CD%"\my_64_bit_ActiveX.dll
It is the 64-bit version of regsvr32 that must be used to register the DLL in the 64-bit registry. We use the full path to regsvr32 to make sure we’re running the 64-bit version.
- Run the .bat “as Administrator”.* On Windows 7, open an Administrator command prompt by going to the Start Menu, enter “cmd” in the search box and instead of pressing Enter, press Ctrl+Shift+Enter. Change directories to where the DLL’s and the batch script are located, and run the registration batch file from there.