Share via

activex control can't create object c# dll in windows 10/7

Fouad.Allali 21 Reputation points
Dec 17, 2021, 12:25 AM

hi MS Team,

i created a dll with vs2015 in c# in windows 7 32 bits and working fine up to now.
i changed my pc where i created the dll to new laptop windows 10 64 bits .
now iam trying to improve the last dll to resolve some errors but it work fine only in my pc .
i tested it in other 3 pc, 2 pc with win10 and other (win7 this pc is already running old version of this dll and the new not work)

always same error : activex control can't create object .
dll is registered correctly and contains the same namespace ,class , public method entries with old version .
the different only in postgres connection.

thanks in advance.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,350 questions
{count} votes

Accepted answer
  1. RLWA32 47,786 Reputation points
    Dec 21, 2021, 9:50 AM

    On Windows 10 start VS2015 as Administrator. This is important so that VS2015 can perform the COM registration during the build process for the C# Class Library project.

    Class Library Project Properties - 32-bit build with COM registration

    159322-props32bit.png

    In this example the C# namespace is CSharpServer and the class is Hello. When this project is built by VS2015 it will perform COM registration and create a ProgId of CSharpServer.Hello in the registry under HKCR. For example,

    159268-progid.png

    The GUID in the example is the CLSID that VS2015s COM registration will create in the 32-bit view of the registry under the WOW6432Node subkey of HKCR. For example, this is the 32-bit registration of the CLSID key in the registry -

    159280-clsid32.png

    Note the WOW6432Node subkey in the path above

    Run script from 64-bit Command prompt. Error is expected for 32-bit server.

    159239-cmd64.png

    Run script from 32-bit Command prompt. Successful execution results.

    159353-cmd32.png

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. RLWA32 47,786 Reputation points
    Dec 18, 2021, 12:48 AM

    On a 64-bit system a COM Server can be registered as either a 64-bit server or a 32-bit server. On a 32-bit Win7 system this isn't something you previously had to manage. But now that you are transitioning to 64-bit Win10 you need to be aware of the issues. It is likely that your COM server is registered as a 32-bit server on the Win10 system. However, if you open a command prompt and try to run a script the process that runs the script is probably a 64-bit process. This would cause the error you have experienced.

    For example, if I have a 32-bit server registered this is the result from a 64-bit process trying to run a script -

    158666-script.png

    Now if I explicitly run the 32-bit script engine using the command "c:\windows\syswow64\cscript tester.vbs" the problem is avoided because a 32-bit process is using a 32-bit server.

    Other options include starting a 32-bit command prompt using "c:\windows\syswow64\cmd.exe" or using a 64-bit COM server and ensuring it is registered in the 64-bit view of the registry.

    0 comments No comments

  2. Fouad.Allali 21 Reputation points
    Dec 19, 2021, 10:46 PM

    hi RLWA32-6355

    iam sorry, but still the same error.

    i programmed other dll in 32 bit but the same error .


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.