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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:32:42+00:00 2026-05-29T22:32:42+00:00

The current projects are all written in VC6 and VB6 . It has been

  • 0

The current projects are all written in VC6 and VB6. It has been proved that .Net can write Active X controls for MFC use. So we’d like to write some active x controls using .Net with minimum changes in the legacy code.

Here is the requirements:

  1. The Host application (written in VC6) must be able to find and load the active x control from the registered category.
  2. The active x control must support property pages.
  3. The active x control must support property persistence.

Here is my questions:

  1. Is it possible to write Active X property pages using .Net WinForm Controls? And how to communicate between controls and corresponding properties in C#?
  2. How to register the Active X control under a certain category in C#? The following is a piece of sample code in MFC regarding to control registration.

    STDAPI DllRegisterServer(void)
    {
    
    HRESULT hr;  
    
    AFX_MANAGE_STATE(_afxModuleAddrThis);
    
    if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
      return ResultFromScode(SELFREG_E_TYPELIB);
    
    if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
      return ResultFromScode(SELFREG_E_CLASS); 
    
    hr = CreateComponentCategory(CATID_CTRL_CAT, 
         L"XXXX");
    if (FAILED(hr))
      return hr;
    
    hr = RegisterCLSIDInCategory(CATID_CONTROL, 
         CATID_CTRL_CAT);
    if (FAILED(hr))
        return hr; 
    
    return NOERROR;
    }
    

    The above registration has 3 steps, AfxOleRegisterTypeLib, CreateComponentCategory and RegisterCLSIDInCategory. How can we implement them in C#?

  3. What is the equivalent way in C# to achieve property persistence?

Thank you in advance for any comments and helps!!!

  • 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-29T22:32:43+00:00Added an answer on May 29, 2026 at 10:32 pm

    I had to write a .NET ActiveX component to be consumed by a legacy application, and I initially explored implementing this in C#. While it’s not terribly difficult to implement a component in C# that provides the bare minimum to satisfy the modern definition of “ActiveX component” (i.e. implement the COM IUnknown interface), building a component in C# that supports all of the drag-and-drop ease of use that was expected by the legacy application developers consuming my component required that it implement many additional COM interfaces.

    My understanding is that it’s technically possible to do this yourself in C#, provided that you import the right COM interfaces and then implement them properly within your component, this would be a lot of work.

    I ended up creating a normal C# component (no ActiveX involved) to contain all of my actual logic, and then I created a C++/CLI (A.K.A. Managed C++) wrapper around my C# component that used MFC to provide the necessary ActiveX functionality.

    Disclaimer: I did not have to deal with property pages or property persistence.

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

Sidebar

Related Questions

I'm required to write documentation for my current project that lists all .c files
In my current project I noticed that all class fields and variable inside methods
How can I list all the classes in my current project(assembly?) using reflection? thanks.
On my .NEt projects I'm used to the tool called ReSharper but my current
I have been assigned a project with a lot of poorly written code that
I've been learning Ruby, just for fun so far (no current projects require Ruby).
I have a situation that involves Companies, Projects, and Employees who write Reports on
I've just started looking at a project that has >20k unit tests written in
I have numerous projects that all contain the exact same boilerplate code inside of
Just starting out with subversion, have set up repos for 3 current projects and

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.