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. How to interact between C# and VC++ applications

How to interact between C# and VC++ applications

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++tutorialquestion
3 Posts 3 Posters 1 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.
  • M Offline
    M Offline
    Mary Chennai
    wrote on last edited by
    #1

    I have a VC++ application(say MathApp) that does some mathematical calculations using some U/I inputs, and gives the results. I have a C# application(say ManagedApp) that wants to interact with MathApp. ManangedApp has to pass the inputs to MathApp, MathApp should perform the calculations, and give back the results to ManagedApp. Can someone suggest different ways to accomplish the above task?

    L L 2 Replies Last reply
    0
    • M Mary Chennai

      I have a VC++ application(say MathApp) that does some mathematical calculations using some U/I inputs, and gives the results. I have a C# application(say ManagedApp) that wants to interact with MathApp. ManangedApp has to pass the inputs to MathApp, MathApp should perform the calculations, and give back the results to ManagedApp. Can someone suggest different ways to accomplish the above task?

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Rinnu Mary wrote:

      I have a VC++ application(say MathApp)

      communicating between processes is a well known topic called Inter-Process Communication[^] However if the MathApp code is designed well the math routines would be separated from the user interface code and they can be built into a library that can then be used by other applications at compile time. This eliminates the need to have two processes involved at runtime and therefore eliminates the IPC scenario. After that it is a matter of dealing with the Native code to Managed code problem. This is where C++/CLI comes in. You can develop a .NET assembly (library) using C++/CLI that contains the C++ MathApp code as well as a managed class of your own design that encapsulates the native code. Once done C# projects can reference this assembly and use the managed class from it to execute the native code contained within the DLL (assembly).

      1 Reply Last reply
      0
      • M Mary Chennai

        I have a VC++ application(say MathApp) that does some mathematical calculations using some U/I inputs, and gives the results. I have a C# application(say ManagedApp) that wants to interact with MathApp. ManangedApp has to pass the inputs to MathApp, MathApp should perform the calculations, and give back the results to ManagedApp. Can someone suggest different ways to accomplish the above task?

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        The easiest method would probably be using WM_COPYDATA Message[^]. Use WM_COPYDATA to send data to/from C++ and C# Windows processes[^] Best Wishes, -David Delaune

        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