Locked VS2010 AxImp OCX COM Interop not working

  • miércoles, 22 de febrero de 2012 16:12
     
     

    Hello,

    I've got an issue with a legacy OCX we're trying to support. Longer term, I think we go other avenues, but for now we must do this unfortunately.

    I am able to register the OCX using RegSvr32; registration succeeds. Now I am trying to reproduce the steps that yield the Interop and AxInterop files; however this is failing.

    I type: AxImp <NameOfOCX>.OCX and the operation fails with: "AxImp Error: Did not find a registered ActiveX control in '<path to OCX>'."

    I've read other places I may need to ensure the "bitness" jives with the development platform? We're targeting a 32-bit environment at the moment, so I need to make sure AxImp sees the OCX as a 32-bit?

    This is in Visual Studio 2010 running in a Windows 7 Pro 64-bit environment.

    How do we do this?

    Thank you...

    Best regards,

    Michael


    • Editado MWPowell miércoles, 22 de febrero de 2012 16:12
    •  

Todas las respuestas

  • jueves, 23 de febrero de 2012 19:35
     
     Respondida

    There is no need to manually generate the interop assembly for an ActiveX control. When you add a COM reference to your .NET project the interop file is created automatically in the bin folder of your project.

    EDIT: You also need to make certain to change the Platform option (Build...Configuration Manager...) to x86, when running under 64-bit Windows, so that the app will run 32-bit.


    Paul ~~~~ Microsoft MVP (Visual Basic)


  • jueves, 23 de febrero de 2012 19:41
     
     
    Oh ok. This is true for any .NET project? We use C# .NET frequently, sometimes C++/CLI. Thank you...
  • jueves, 23 de febrero de 2012 19:53
     
     
    I'm not a C#/C++/CLI developer so I would just recommend trying it with those projects types. I can't see where it would be different for managed code solutions.

    Paul ~~~~ Microsoft MVP (Visual Basic)