For object links and embedded (OLE) controls that can be registered, such as dynamic link library (DLL) files, or ActiveX Control (OCX) files, you can use the Regsvr32 tool (Regsvr32.exe) to register and unregister them.
Usage of Regsvr32.exe
Regsvr32.exe has the following command line option: regsvr32 [/ u] [/ n] [/ i [: cmdline]] Dllname
/ U - Unregister Server / I - Call Dllinstall Passing It An Optional [CMDLINE]; WHEN USED WITH / U Calls DLL Uninstall / N - Do Not Call DLLREGISTERSERVER; this option MUST BE USED WITH / I
When you use regsvr32.exe, it will try to load the component and call its Dllselfregister function. If this attempt is successful, Regsvr32.exe displays a dialog that indicates success. If this attempt fails, regsvr32.exe returns an error message, which may include a Win32 error code. To view a list of Win32 error codes, see the Microsoft Web site below: http://msdn.microsoft.com/library/en-us/netdir/adsi/win32_error_codes.asp
For example, to manually register the Sample.ocx ActiveX control, type the following command at the MS-DOS prompt: c: /regsvr32.exe sample.ocx
Regsvr32.exe error message
The following list describes the REGSVR32 error messages and possible reasons.
Unrecognized flag: / invalid_flag
The typed flag or switch combination is invalid (see "Usage" section of "Regsvr32.exe" in this article).
NO DLL Name Specified.
Not included in the .dll file name (see "Usage" section of "Regsvr32.exe" in this article).
Dllname Was Loaded, But The DllregisterServer or DllunregisterServer Entry Point Was Not Found.
Dllname is not .dll or .ocx file. For example, type Regsvr32 WJView.exe generates the error message.
Dllname is not an executable file and no registration helper is registered for this file type.
DllName is not an executable file (.exe, .dll or .ocx). For example, type Regsvr32 autoexec.bat generates the error message.
Dllname Was Loaded, But The DllregisterServer or DllunregisterServer Entry Point Was Not Found.
Dllname may not be exported, or may have damaged Dllname versions in memory. Consider using PVIEW to detect the file and delete it.
Dllname is not self-registerable or a corrupted version is in memory.
For example, the error message is returned after typing regsvr32 icwdial.dll because the icwden.dll file cannot be registered himself. If you suspect that there is a damaged Dllname version in memory, try restart your computer or re-extract the original version of the file. If you are running Windows NT, you may need to use the Kill or PVIEW tool in the Microsoft Windows NT Server 4.0 Resource Toolkit. For additional information, click to view the following Microsoft Knowledge Base Article: 197155 How to terminate the Isolated Process Oleinitialize Failed (OR OleunInitialize Faile).
Regsvr32 must initially initialize the COM library before you can call the desired COM library function and undo the initialization of the library when it is turned off. These error messages will appear if you initialize or revoke the initialization of the COM library. For example, the OLE32.DLL file may be damaged, or its version is incorrect.
LoadLibrary ("dllname") failed.getlasterror returns 0x00000485
In WineError.h, 0x00000485 = 1157 (Error_DLL_NOT_FOUND), indicating "a library file that is not required to run the application". For example, when you type regsvr32 missing.dll, the error message will be returned if the missing.dll file is not found.
LoadLibrary ("dllname") failed.getlasterror returns 0x00000002
In WineError.h, 0x00000002 = 2 (error_file_not_found), means "The system cannot find the specified file". In other words, the system cannot find the relevant DLL. For example, if you type regsvr32 icwdial.dll, it is missing the TAPI32.DLL (depending on item), it will return the error message.
LoadLibrary ("DSKMAINT.DLL") Failed.getlasterror Returns 0x000001F
In WineError.h, 0x000001F = 31 (Error_Gen_Failure), indicating that "the device attached to the system is not working properly". This happens if you try to register a Win16.dll file. For example, type Regsvr32 DSKMAINT.DLL returns the error message.
DllRegisterServer (or DllunregisterServer) in dllname failed. Return code is: string
Search strings in WineError.h. Regsvr32.exe and dependencies Regsvr32.exe depends on kernel32.dll, user32.dll, and ole32.dll files (in Windows NT, depending on MSVCRT.DLL and Advapi32.dll files). Regsvr32.exe will load you try register or revoke the registration file and all its dependencies. If the required files are missing or they are damaged, the process may fail.