Managed code with C# and VC++

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Francis Urquhart

    #1

    Managed code with C# and VC++

    I am trying to find the simplest possible way of writing a
    GUI to run on top of a standard C++ library written in
    VC++. I would like to avoid MFCs, COM, and if
    possible .Net wrappers. The goal is just to be able to
    demonstrate the capabilities of the library, rather than
    create a finished product.

    I have read things here and there about "managed code",
    where you can write a GUI in C# to interface with
    C++ "unmanaged" code. However, after searching through
    pages and pages on MSDN, plus external sites, I remain
    more confused than ever. If anyone could help answer the
    following questions, or point me to some useful references
    on the web or in print, I would greatly appreciate it.

    1. Does managed/unmanaged code (using C# and VC++) allow
    you to bypass MFCs and COM?

    2. If so, is it still necessary to write some type of .Net
    wrapper to instantiate the C++ objects?

    3. Can this be done with the standard .Net 2003 versions
    of C# and VC++, or does it require purchasing .Net
    Professional?

    Again, any feedback or references would be appreciated.

    Thanks in advance.



  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Managed code with C# and VC++

    Francis,

    See inline:

    "Francis Urquhart" <francis_urquha rt@yahoo.co.jp> wrote in message
    news:097c01c345 5f$b365aaa0$a00 1280a@phx.gbl.. .[color=blue]
    > I am trying to find the simplest possible way of writing a
    > GUI to run on top of a standard C++ library written in
    > VC++. I would like to avoid MFCs, COM, and if
    > possible .Net wrappers. The goal is just to be able to
    > demonstrate the capabilities of the library, rather than
    > create a finished product.
    >
    > I have read things here and there about "managed code",
    > where you can write a GUI in C# to interface with
    > C++ "unmanaged" code. However, after searching through
    > pages and pages on MSDN, plus external sites, I remain
    > more confused than ever. If anyone could help answer the
    > following questions, or point me to some useful references
    > on the web or in print, I would greatly appreciate it.
    >
    > 1. Does managed/unmanaged code (using C# and VC++) allow
    > you to bypass MFCs and COM?[/color]

    Yes, it does. You can write managed code which accesses unmanaged code,
    but that unmanaged code has to provide a managed interface of some sort.
    [color=blue]
    >
    > 2. If so, is it still necessary to write some type of .Net
    > wrapper to instantiate the C++ objects?[/color]

    Yes, it is. Otherwise, the runtime would have no clue how to interact
    with the unmanaged code.
    [color=blue]
    >
    > 3. Can this be done with the standard .Net 2003 versions
    > of C# and VC++, or does it require purchasing .Net
    > Professional?[/color]

    You should be able to do it without the IDE, you should be able to do it
    with just the .NET framework (although it would be a little more difficult,
    as everything is from the command line).

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - nicholas.paldin o@exisconsultin g.com
    [color=blue]
    >
    > Again, any feedback or references would be appreciated.
    >
    > Thanks in advance.
    >
    >
    >[/color]


    Comment

    • Nicholas Paldino [.NET/C# MVP]

      #3
      Re: Managed code with C# and VC++

      Francis,

      I would definitely use C# for the GUI code. It would probably be easier
      (IMO), but it all depends on what you are used to. If you can create the
      wrappers for your classes, then you really have 95% of the work done, as
      there is little to do after that besides create the GUI. If you have
      complex GUI requirements, then I would use C++, but if your requirements are
      pretty standard, then I would use C# to call your wrapped classes.


      --
      - Nicholas Paldino [.NET/C# MVP]
      - nicholas.paldin o@exisconsultin g.com

      "Francis Urquhart" <francis_urquha rt@yahoo.co.jp> wrote in message
      news:0ebc01c345 63$3ed80850$a50 1280a@phx.gbl.. .[color=blue]
      > Nicholas,
      >
      > Thanks for your reply. That definitely helps.
      >
      > Just one follow-up: Would you recommend the C# route
      > rather than just trying to create a GUI using VC++ alone?
      > That is, would it be a simpler process to create the .Net
      > wrapper and code the GUI in C# rather than using the GUI
      > tools in VC++ (especially if I were to use the .Net
      > Professional IDE)?
      >
      > Sorry for all the questions -- I've been working with UNIX
      > the past five years and know very little about the .Net
      > environment.
      >
      > -Francis
      >
      >[color=green]
      > >-----Original Message-----
      > >Francis,
      > >
      > > See inline:
      > >
      > >"Francis Urquhart" <francis_urquha rt@yahoo.co.jp> wrote[/color]
      > in message[color=green]
      > >news:097c01c34 55f$b365aaa0$a0 01280a@phx.gbl. ..[color=darkred]
      > >> I am trying to find the simplest possible way of[/color][/color]
      > writing a[color=green][color=darkred]
      > >> GUI to run on top of a standard C++ library written in
      > >> VC++. I would like to avoid MFCs, COM, and if
      > >> possible .Net wrappers. The goal is just to be able to
      > >> demonstrate the capabilities of the library, rather than
      > >> create a finished product.
      > >>
      > >> I have read things here and there about "managed code",
      > >> where you can write a GUI in C# to interface with
      > >> C++ "unmanaged" code. However, after searching through
      > >> pages and pages on MSDN, plus external sites, I remain
      > >> more confused than ever. If anyone could help answer[/color][/color]
      > the[color=green][color=darkred]
      > >> following questions, or point me to some useful[/color][/color]
      > references[color=green][color=darkred]
      > >> on the web or in print, I would greatly appreciate it.
      > >>
      > >> 1. Does managed/unmanaged code (using C# and VC++) allow
      > >> you to bypass MFCs and COM?[/color]
      > >
      > > Yes, it does. You can write managed code which[/color]
      > accesses unmanaged code,[color=green]
      > >but that unmanaged code has to provide a managed[/color]
      > interface of some sort.[color=green]
      > >[color=darkred]
      > >>
      > >> 2. If so, is it still necessary to write some type[/color][/color]
      > of .Net[color=green][color=darkred]
      > >> wrapper to instantiate the C++ objects?[/color]
      > >
      > > Yes, it is. Otherwise, the runtime would have no[/color]
      > clue how to interact[color=green]
      > >with the unmanaged code.
      > >[color=darkred]
      > >>
      > >> 3. Can this be done with the standard .Net 2003 versions
      > >> of C# and VC++, or does it require purchasing .Net
      > >> Professional?[/color]
      > >
      > > You should be able to do it without the IDE, you[/color]
      > should be able to do it[color=green]
      > >with just the .NET framework (although it would be a[/color]
      > little more difficult,[color=green]
      > >as everything is from the command line).
      > >
      > > Hope this helps.
      > >
      > >
      > >--
      > > - Nicholas Paldino [.NET/C# MVP]
      > > - nicholas.paldin o@exisconsultin g.com
      > >[color=darkred]
      > >>
      > >> Again, any feedback or references would be appreciated.
      > >>
      > >> Thanks in advance.
      > >>
      > >>
      > >>[/color]
      > >
      > >
      > >.
      > >[/color][/color]


      Comment

      • Francis Urquhart

        #4
        Re: Managed code with C# and VC++

        Nicholas,

        Thanks for your reply. That definitely helps.

        Just one follow-up: Would you recommend the C# route
        rather than just trying to create a GUI using VC++ alone?
        That is, would it be a simpler process to create the .Net
        wrapper and code the GUI in C# rather than using the GUI
        tools in VC++ (especially if I were to use the .Net
        Professional IDE)?

        Sorry for all the questions -- I've been working with UNIX
        the past five years and know very little about the .Net
        environment.

        -Francis

        [color=blue]
        >-----Original Message-----
        >Francis,
        >
        > See inline:
        >
        >"Francis Urquhart" <francis_urquha rt@yahoo.co.jp> wrote[/color]
        in message[color=blue]
        >news:097c01c34 55f$b365aaa0$a0 01280a@phx.gbl. ..[color=green]
        >> I am trying to find the simplest possible way of[/color][/color]
        writing a[color=blue][color=green]
        >> GUI to run on top of a standard C++ library written in
        >> VC++. I would like to avoid MFCs, COM, and if
        >> possible .Net wrappers. The goal is just to be able to
        >> demonstrate the capabilities of the library, rather than
        >> create a finished product.
        >>
        >> I have read things here and there about "managed code",
        >> where you can write a GUI in C# to interface with
        >> C++ "unmanaged" code. However, after searching through
        >> pages and pages on MSDN, plus external sites, I remain
        >> more confused than ever. If anyone could help answer[/color][/color]
        the[color=blue][color=green]
        >> following questions, or point me to some useful[/color][/color]
        references[color=blue][color=green]
        >> on the web or in print, I would greatly appreciate it.
        >>
        >> 1. Does managed/unmanaged code (using C# and VC++) allow
        >> you to bypass MFCs and COM?[/color]
        >
        > Yes, it does. You can write managed code which[/color]
        accesses unmanaged code,[color=blue]
        >but that unmanaged code has to provide a managed[/color]
        interface of some sort.[color=blue]
        >[color=green]
        >>
        >> 2. If so, is it still necessary to write some type[/color][/color]
        of .Net[color=blue][color=green]
        >> wrapper to instantiate the C++ objects?[/color]
        >
        > Yes, it is. Otherwise, the runtime would have no[/color]
        clue how to interact[color=blue]
        >with the unmanaged code.
        >[color=green]
        >>
        >> 3. Can this be done with the standard .Net 2003 versions
        >> of C# and VC++, or does it require purchasing .Net
        >> Professional?[/color]
        >
        > You should be able to do it without the IDE, you[/color]
        should be able to do it[color=blue]
        >with just the .NET framework (although it would be a[/color]
        little more difficult,[color=blue]
        >as everything is from the command line).
        >
        > Hope this helps.
        >
        >
        >--
        > - Nicholas Paldino [.NET/C# MVP]
        > - nicholas.paldin o@exisconsultin g.com
        >[color=green]
        >>
        >> Again, any feedback or references would be appreciated.
        >>
        >> Thanks in advance.
        >>
        >>
        >>[/color]
        >
        >
        >.
        >[/color]

        Comment

        Working...