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 906355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:22:30+00:00 2026-05-15T16:22:30+00:00

I am creating C# application that uses OCX component. I have this component from

  • 0

I am creating C# application that uses OCX component. I have this component from manufacturer of some kind of printer. During installation of their files, foo.ocx was added to my C:\Windows\System32.

The only thing I had to do is add reference in Solution Explorer, and point that library in COM tab. Then I took interface:

[Guid("XXX")]
 [CoClass(typeof(FooClass))]
 public interface Foo : IFoo { }

and I created instance of COM interface:

 class Program
 {
  static void Main(string[] args)
  {
   var foo = new Foo();
  }
 }

and everything works OK. Am I doing this right?

The second thing and more important to me is, that I am not sure how to deploy this. Referenced file in solution explorer has properties: Embed Interop Type: True, Isolated: False. This will lead to only 1 exe file in build directory. I would like to use my application on other machine, so I have to do something, but I am not sure, what. I tried to change properties of that reference, including copy local, but I suspect I have to install this ocx file on other machine. Should I use regsvr32 or regasm? Shoud I register this ocx file or something else?

  • 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-05-15T16:22:31+00:00Added an answer on May 15, 2026 at 4:22 pm

    Hans Passant already answered my question, but I have just find out, that setting Isolated in reference properties to True will do the job – exe, exe.manifest and original ocx file will be put into release folder, but this will only work, if I mark my Main method with [STAThread] attribute:

    class Program
    {
     [STAThread]
     static void Main(string[] args)
     {
      var foo = new Foo();
     }
    }
    

    Without this running the exe will lead to InvalidCastException. After that, I don’t really need to register that ocx with regsvr32.

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

Sidebar

Related Questions

I am creating an application that works like the 'wizard' component of some microsoft
I have an application that uses OAuth whose logic is something like this: If
I'm creating an application that uses an ImageSwitcher to show some images. I want
We are creating an iPad application that uses multiple SplitViewController. From the Apple documentation
I have an Android application that uses C2DM. I am creating another application derived
I am creating an GUI application in java that uses input from the user
I am creating an application that uses popups. However, I would like to animate
I'm creating a Facebook application that uses many calls to Facebook's asynchrunner class. As
I am creating an application that will have a list of items that can
I'm creating an application that uses amazon s3 for storage in C#. It may

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.