Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Managed DLL with unmanaged MFC application

Managed DLL with unmanaged MFC application

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++questionvisual-studioworkspace
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stub
    wrote on last edited by
    #1

    I'm just starting to dive into Visual Studio .NET 2003 and have been attempting to find the answer on how I can use C++ managed DLL's with an older VC6.0 MFC application. Here's the scenario: I have several large MFC applications that currently use functions contained in MFC DLL's. These DLL's aren't large so converting the DLL's to a true managed DLL in .NET is not cumbersome however, attempting to convert the applications at this stage would not be feasible. The converted DLL's will also be used by new .NET managed applications. My question is simply can a managed DLL written in C++ (or C# for that matter) under .NET be used by traditional VC6.0 MFC applications as well as new .NET web form applications? If so how does one setup the DLL to do this? - stub

    N H R 3 Replies Last reply
    0
    • S stub

      I'm just starting to dive into Visual Studio .NET 2003 and have been attempting to find the answer on how I can use C++ managed DLL's with an older VC6.0 MFC application. Here's the scenario: I have several large MFC applications that currently use functions contained in MFC DLL's. These DLL's aren't large so converting the DLL's to a true managed DLL in .NET is not cumbersome however, attempting to convert the applications at this stage would not be feasible. The converted DLL's will also be used by new .NET managed applications. My question is simply can a managed DLL written in C++ (or C# for that matter) under .NET be used by traditional VC6.0 MFC applications as well as new .NET web form applications? If so how does one setup the DLL to do this? - stub

      N Offline
      N Offline
      Nathan Blomquist
      wrote on last edited by
      #2

      stub wrote: If so how does one setup the DLL to do this? Yes, you can get VC6 to work with Managed DLLs, but you will need to look into the topic of COM Interop. This makes it so that a Managed DLL acts just like a COM Dll and therefore can be used by any COM compatible language (VC6, VB6, etc). -Nathan --------------------------- Hmmm... what's a signature?

      1 Reply Last reply
      0
      • S stub

        I'm just starting to dive into Visual Studio .NET 2003 and have been attempting to find the answer on how I can use C++ managed DLL's with an older VC6.0 MFC application. Here's the scenario: I have several large MFC applications that currently use functions contained in MFC DLL's. These DLL's aren't large so converting the DLL's to a true managed DLL in .NET is not cumbersome however, attempting to convert the applications at this stage would not be feasible. The converted DLL's will also be used by new .NET managed applications. My question is simply can a managed DLL written in C++ (or C# for that matter) under .NET be used by traditional VC6.0 MFC applications as well as new .NET web form applications? If so how does one setup the DLL to do this? - stub

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        There is another way besides COM interop, but it's not easy and probably not recommended (being that most of the functions and structures are undocumented). You can host the CLR yourself using the unmanaged functions of the .NET Framework. You create a default AppDomain that creates your application's AppDomain. From there, you can actually do some things with the managed DLL, but it is a difficult process. COM interop is definitely easier, I just wanted to provide another alternative. For more information, look-up CorBindToCurrentRuntime and CorBindToRuntimeEx. This will give you the starting points for the rest.

        Reminiscent of my younger years...

        10 LOAD "SCISSORS" 20 RUN

        1 Reply Last reply
        0
        • S stub

          I'm just starting to dive into Visual Studio .NET 2003 and have been attempting to find the answer on how I can use C++ managed DLL's with an older VC6.0 MFC application. Here's the scenario: I have several large MFC applications that currently use functions contained in MFC DLL's. These DLL's aren't large so converting the DLL's to a true managed DLL in .NET is not cumbersome however, attempting to convert the applications at this stage would not be feasible. The converted DLL's will also be used by new .NET managed applications. My question is simply can a managed DLL written in C++ (or C# for that matter) under .NET be used by traditional VC6.0 MFC applications as well as new .NET web form applications? If so how does one setup the DLL to do this? - stub

          R Offline
          R Offline
          rahtrow
          wrote on last edited by
          #4

          This article may point you in the right direction... Walkthrough: Exploring COM Interoperability with ATL and Managed Extensions for C++[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups