regsvr32 fails with "LoadLibrary failed - The specified module could not be found"
When attempting to register a COM object (e.g. Active-X
component or OCX) with '
it fails with a message box displaying:
LoadLibrary("COM") failed - The specified module could not be found
COM' is the name of the COM object file.
Possible causes and remedies:
- The name of the COM object is wrong.
Check that the name supplied to regsvr32 is correct. Check both the name and that the file is in the current directory.
- The COM object requires another library which is missing.
The name of the COM object is correct, but the COM object in turn requires another DLL and it is that subsequent DLL which is missing.
There are a number of ways of identifying which DLL is missing. The following always for me:
- Download a utility called "Process Monitor" from System Internals. This is a free utility that lets you log all file system accesses.
- Run Process Monitor, it will capture all file system activity.
- Do regedt32 again. It will fail, but it is the log from Process Monitor which is of interest.
- Tell Process Monitor to stop logging, do this by clicking on the magnifying glass in the toolbar. Do not wipe the log!
- Work from the bottom of the log upwards. What you are logging for is a line that has the process as "regsvr32.exe" and the result as "FILE NOT FOUND". Under Path it will show you what DLL it was looking for. This is the missing DLL.
Once you have identified the missing DLL it is up to you how you obtain a replacement. If you are porting objects from one PC to another (which is when I've encountered this problem) then it is reasonable to assume that the "old" PC has a copy of the missing DLL.
These notes have been tested with Windows XP Professional.
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.