CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Location
    Orange County, CA
    Posts
    99

    Question C++ code w/ a C# GUI???

    I am currently working on a large simulation for a programming class. We had to code the entire thing in C++ (I use 6.0) and then simply display information in the console window. However, we get extra credit if we add extra features to the simulation. Which brings me to my question:
    Is there an easy way to create a GUI (in either C# or MFC, but preferably C#) that works in conjunction with my C++ code?

    The GUI will need to update its display each time the simulation processes an event.

    Any suggestions will be greatly appreciated!

  2. #2
    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    762
    If you use a C# GUI with C++ code, you're going to have to compile your C++ code into a DLL and import each function into the C# application and access them that way.

    Your best bet would be to use something like qt or wxWidgets.

    Impress your professor and show him you have a C++ program that works on Windows, Linux and Mac OS

  3. #3
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664
    Create a C++ static library (ie API) of your C++ program.
    Then you have two options:
    1. Create a COM wrapper
    2. Create a C++.NET library wrapper (you'll probably need VC.NET for this)

    After you've done the above things, it is very easy to use and call C++ code that implements the simulation stuff, from C# (or any other .NET language). I would guess option #2 is some what easier, but if you only have VC6, you may have to go for the first option.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured