locked
Hosting VB .NET User Control in C++ Application RRS feed

  • Question

  • After I create a VB .NET VB6 User Interop control can that control be used in a C++ application. Also, If that control is used as a plug-in to a C++ app, what components are required to be present on the target machine running the C++ app beside the .dll for the user interop control I made?

    Wednesday, May 16, 2007 2:27 PM

Answers

  • Lou,

     

    According to your problem, I would like to provide you an article on the issue. Please read the article carefully and I hope that can help you with the problem:

     

    Description of the supportability of Winforms controls in unmanaged applications

    http://support.microsoft.com/kb/897863

     

    This article contains information about the supportability of using Microsoft .NET Windows Forms (Winforms) controls in an unmanaged application. These unmanaged applications may include Microsoft Visual Basic 6.0 applications, Microsoft Foundation Classes (MFC) applications, or Microsoft Internet Explorer.

     

    Scenario 1: Host Winforms components as ActiveX controls

    To use Winforms controls in your application, you have to either host the common language runtime by using the unmanaged CLR hosting APIs or use the Managed Extensions for C++ to implement your application. We recommend that you use Managed Extensions for C++.

     

    Scenario 2: Display a Winforms form from an unmanaged application

    In the .NET Framework, you can display a Winforms form from an unmanaged application, such as a Visual Basic 6.0 application or an MFC 6.0 application. This scenario is supported. You can create a class library in Winforms that includes a method to display the form, and then build the class library for COM Interop. After you create and build the class library, you can use the Interop .dll file from Visual Basic 6.0 or from MFC, and then call the method to display the form. The key is to create a Winforms message pump in the Winforms form. The Winforms form can then run on the message pump.

     

     

    Tuesday, May 22, 2007 2:34 AM