[dll] Register 32 bit COM DLL to 64 bit Windows 7

I have a 32 bit COM component DLL and this DLL is written in Delphi. It's a Win32 DLL. I want to use this DLL in my Visual C# project on .NET platform.

I can't add reference to this DLL in the project. I try to register it in Command Prompt as Administrator in Windows 7 64 bit, but I get this error:

Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe.

First I put DLL file to windows/system32 folder. Then I open Command Prompt as Administrator. I write regsvr32 huginalpha.dll and execute this command. But I get the error. what can I do?

This question is related to dll windows-7 com

The answer is


put the dll in system32 or syswow32 directory, and use appropriate regsvr32 to register it. wiered that even though it gave failed to register error, I rebooted my WIN 7 64 AND my vb app loaded the dll just fine!!


Below link saved the day

https://msdn.microsoft.com/en-us/library/ms229076(VS.80).aspx

use the relevant RegSvcs as specified in the above link

c:\Windows\Microsoft. NET\Framework\v4.0.30319\RegSvcs.exe ....\Shared\Your.dll /tlb:Your.tlb


I was getting the error "The module may compatible with this version of windows" for both version of RegSvr32 (32 bit and 64 bit). I was trying to register a DLL that was built for XP (32 bit) in Server 2008 R2 (x64) and none of the Regsr32 resolutions worked for me. However, registering the assembly in the appropriate .Net worked perfect for me. C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe


I believe, things have changed now. On My Win 2008 R2 Box, I was able to register a 32 bit dll with a 64 bit regsvr32 as the 64 bit version can detect the target bitness and spawn a new 32 bit regsvr32 from %SYSWOW% folder.

Refer: Registering a 32 bit DLL with 64 bit regsvr32


http://onerkaya.blogspot.com/2013/03/register-com-dll-on-windows-64-bit.html

Retrieving the COM class factory for component with CLSID {...} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

if you try this;

c:\windows\system32\regsvr32.exe < filename >.dll

you can still take this exception. so IIS- pool Advanced settings, Enable 32 bit application : true ;)


For 32 bit DLLS in Windows 64 bit platforms:

  1. Copy whatever.dll to c:\windows\sysWOW64\
  2. Open a CMD prompt AS ADMINISTRATOR (very important)

In the CMD window:

  1. CD c:\windows\sysWOW64\
  2. regsvr32 whatever.dll

You will then be executing the 32-bit regsvr (c:\windows\sysWOW64\regsvr.exe) on a 32 bit dll


To register a comm .dll or .ocx on Windows 7 32-bit, do the following:

Copy .dll or .ocx to c:\windows\system32 Type cmd in Run menu, it will search cmd.exe, right click and click Run as Administrator

It will show a prompt at c:\windows\system32

Type

regsvr32 ocxname.ocx to register .ocx

or

type regsvr32 dllname.dll to register .dll


If problem not resolved, when using SysWoW64 version of regsvr32, make sure all library dependencies have same archetecture. For example, when

regsvr32 lib_x86.dll fails to register library, and %SystemRoot%\SysWow64\regsvr32 lib_x86 also fails, try to load lib_x86 to Dependency Walker application to see whole list of dependencies. If any item have 64-bit archetecture, here is the reason, why regsvr32 fails to load 32-bit library.


Try to run it at Framework64.

Example:

  • 32 bit

    C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe D:\DemoIconOverlaySln\Demo\bin\Debug\HandleOverlayWarning\AsmOverlayIconWarning.dll /codebase 
    
  • 64 bit

    C:\Windows\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe D:\DemoIconOverlaySln\Demo\bin\Debug\HandleOverlayWarning\AsmOverlayIconWarning.dll /codebase
    

Examples related to dll

The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing while starting Apache server on my computer PHP 7: Missing VCRUNTIME140.dll How to fix PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_curl.dll'? WampServer: php-win.exe The program can't start because MSVCR110.dll is missing msvcr110.dll is missing from computer error while installing PHP installing JDK8 on Windows XP - advapi32.dll error The program can’t start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this program ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there Loading DLLs at runtime in C# Missing `server' JVM (Java\jre7\bin\server\jvm.dll.)

Examples related to windows-7

ng is not recognized as an internal or external command Why am I getting ImportError: No module named pip ' right after installing pip? How to Delete node_modules - Deep Nested Folder in Windows Telnet is not recognized as internal or external command Multiple -and -or in PowerShell Where-Object statement How do I set ANDROID_SDK_HOME environment variable? Run Batch File On Start-up Why isn't .ico file defined when setting window's icon? How to access shared folder without giving username and password Can't start hostednetwork

Examples related to com

Class not registered Error The #include<iostream> exists, but I get an error: identifier "cout" is undefined. Why? How can I generate UUID in C# How to repair COMException error 80040154? BSTR to std::string (std::wstring) and vice versa Microsoft.Office.Core Reference Missing System.Runtime.InteropServices.COMException (0x800A03EC) Error 80040154 (Class not registered exception) when initializing VCProjectEngineObject (Microsoft.VisualStudio.VCProjectEngine.dll) How to handle AccessViolationException Register 32 bit COM DLL to 64 bit Windows 7