Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7894803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:29:16+00:00 2026-06-03T07:29:16+00:00

I have ocx created in VC++ If it is loaded statically it works fine

  • 0

I have ocx created in VC++ If it is loaded statically it works fine but when I load it dynamically from assembly it gives exception .

    public Assembly assembly;

    public Form1()
    {
        InitializeComponent();            
       assembly = Assembly.LoadFile(Application.StartupPath + "\\abc.ocx");

    }

it gives following exception The module was expected to contain an assembly manifest.

(Exception from HRESULT: 0x80131018)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:29:17+00:00Added an answer on June 3, 2026 at 7:29 am

    You’ll have to perform a number of steps that are normally taken of automatically when you use the toolbox. First and foremost, you have to run the Aximp.exe utility to generate the .NET interop assemblies. Use the Visual Studio Command Prompt to run the tool. You’ll get two assemblies, axinterop.foo.dll contains a wrapper class that’s derived from AxHost and allows you to put the control on a form. And interop.foo.dll, the interop assembly that makes the COM interfaces implemented by the control callable from a .NET program.

    Next you have to ensure these DLLs are present in the build directory. Best thing to do is to add them to your project and set their Copy to Output Directory to “Copy if newer”.

    Now you can use Assembly.Load(“axinterop.foo.dll”) in your code to dynamically load the interop assembly.

    Next you have to create an instance of the control, use Assembly.CreateInstance() and pass the type name of the AxHost wrapper class. If you have no idea what its name might be, it isn’t obvious, then use ildasm.exe to look at the axinterop.foo.dll assembly. Cast the returned object to AxHost.

    Next you have to add the control to the form’s Controls collection so it is visible and usable. You cannot call any interface methods until the control instance is created, that doesn’t happen until you’ve added the control and the form’s Load event has fired.

    Next you have to use reflection or the dynamic keyword to obtain a reference to the interfaces implemented by the control, in case you need to set properties or call methods. That’s difficult to get right, you’ll want to write that code first with the control added from the toolbox so you don’t have to guess too hard at the proper names.


    This is obviously all quite painful and hard to get right. Improve the odds for a good outcome by adding a class library to your project that uses the OCX directly and exposes its important properties through an interface. And use Assembly.Load() on that one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating C# application that uses OCX component. I have this component from
I have been trying to load a OCX file into one of my VB6
I have to load a couple of OCX libraries to access legacy code. I
I have a legacy ASP web site that uses the treeview control from COMCTL32.OCX.
I have inherited a load of VB6 code which has tons of individual OCX
Today we have a windows application that, using an OCX, creates a web page
I have an .ocx/ActiveX library that I coded in Delphi. I have thoroughly tested
I have an ActiveX control (an OCX file) which raises an event. I want
Have someone tried out DeCAL in Delphi 2009? I'm thinking about upgrading from 2007,
Have you ever created or encountered a self modifying code in Java? If yes,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.