GUI programming, MFC and C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Siddharth Jain

    GUI programming, MFC and C#

    Hello,

    Could someone please tell me the history of GUI programming for
    windows. In the early days, we had to write 100s of lines of code to
    make a simple dialog box. Then along came MFC to simplify things. And
    now, finally we have visual C#.NET.
    Is that right? Is there anything else to it? Can someone please guide
    me to some link form where I can get to know how things evolved from
    pre-MFC to MFC to where we are now.


    Now...here is my problem....I have an application which was made years
    back. Its GUI has been written using MFC. Now I need to make some
    changes and make a newer verison of it. But for that I will have to
    teach myself MFC (I am familiar with C#). The only advantage of using
    MFC is that MUCH of the earlier code will be reused. Is there any way
    to get around this? I really wish I could write the GUI in C# and still
    reuse the code of the precious stuff.

    Thanks
    Siddharth

  • Morten Wennevik

    #2
    Re: GUI programming, MFC and C#

    With Avalon there will be XAML :P Then you can script GUI in WinForms as you would do with a WebPage.


    On Fri, 27 May 2005 13:59:50 +0200, Siddharth Jain <siddharth_jain _1@rediffmail.c om> wrote:
    [color=blue]
    > Hello,
    >
    > Could someone please tell me the history of GUI programming for
    > windows. In the early days, we had to write 100s of lines of code to
    > make a simple dialog box. Then along came MFC to simplify things. And
    > now, finally we have visual C#.NET.
    > Is that right? Is there anything else to it? Can someone please guide
    > me to some link form where I can get to know how things evolved from
    > pre-MFC to MFC to where we are now.
    >
    >
    > Now...here is my problem....I have an application which was made years
    > back. Its GUI has been written using MFC. Now I need to make some
    > changes and make a newer verison of it. But for that I will have to
    > teach myself MFC (I am familiar with C#). The only advantage of using
    > MFC is that MUCH of the earlier code will be reused. Is there any way
    > to get around this? I really wish I could write the GUI in C# and still
    > reuse the code of the precious stuff.
    >
    > Thanks
    > Siddharth
    >
    >[/color]



    --
    Happy coding!
    Morten Wennevik [C# MVP]

    Comment

    • Nick Malik [Microsoft]

      #3
      Re: GUI programming, MFC and C#

      Hello Siddharth,

      Not sure how the history will help you.
      Xerox PARC came up with the fundamental ideas of the overlapping window.
      Apple lept on the idea with the LISA and then the Mac, creating a great deal
      of interest. A number of systems appeared for the DOS platform that
      provided window-style views, which led to Microsoft developing a number of
      iterations of a product called Windows that didn't take off until Windows
      3.0 came out.

      At that point, C was the language of choice and there were only a few
      "controls" that were native to the system.
      (I wrote one or two C apps to use the first windows interface... it wasn't
      easy).

      As Microsoft made the transition to C++, some other folks suggested that the
      way to open up GUI development was to provide visual designers. The first
      successful one was Visual Basic. So, around the time that C++ and MFC were
      getting up steam, VB presented millions of folks with a way to develop GUI
      apps without writing in either C or C++. Delphi, Powerbuilder, and others
      took this direction to new heights, and many pre-existing languages like
      FoxPro added GUI capabilities and took them in new directions.

      Microsoft added visual designers to C++ through Visual Studio using MFC.
      Microsoft also pursued the COM architecture and made it trivial to create
      COM apps in Visual Basic. (It took a bit more work to do COM in C++).

      Then the Internet came along. Microsoft jumped in with both feet, but it
      took the invention of Java to really shake things up. Java understood the
      web inherently, and was small and fast to download. Microsoft came out
      first with ATL, and then jumped on the Java bandwagon. At one time,
      Microsoft's JVM was the fastest one available.

      Microsoft saw the advantages and disadvantages of Java and hired some of the
      current "bright lights" of programming language development to come to
      Redmond. They began working on Microsoft's next generation of languages
      based on the strengths of Java but closer to C++ in style. Then SUN sued,
      and put Microsoft out of the Java business.

      Around the same time, Microsoft's efforts came to fruit, and MS put out the
      ..Net framework along with C# and VB.Net and partners that delivered dozens
      of additional languages. Java is still strong. My personal opinion is that
      C# is quite strong as well. SUN created a fierce competitor when it decided
      to kick MS out of the Java game. Only time will tell which will ultimately
      become a de-facto standard.

      Now, on to your real problem: None of that matters. You have an app that
      uses MFC. MFC has no descendents. There is no easy transition from MFC to
      anything.

      Depending on the size of your app, you could go one of two ways (a1-a4) or
      (b):

      a1) become or hire an MFC and COM expert.
      a2) Seperate your existing app so that the business logic is different from
      the GUI code.
      a3) Put the Business object into COM components that your GUI code calls.
      a4) Then write a new GUI in C# to call the former systems' business logic.

      b) start over in C#.

      The size and complexity of your app will dictate the direction you should
      take. You may want to outsource (a1-a3) (see RentACoder.Com) and see what
      comes back. That would give you the ability to do (a4) yourself. You will
      still need to know COM and MFC to add any new business functionality, but it
      is a lot easier than starting over and you are less likely to introduce
      defects. Regression testing is easier as well because, at some point, you
      can have a C# app and a C++ app side by side and you can see, for yourself,
      if your new GUI does the exact same things as the old GUI does.

      Hope that helps,

      --
      --- Nick Malik [Microsoft]
      MCSD, CFPS, Certified Scrummaster


      Disclaimer: Opinions expressed in this forum are my own, and not
      representative of my employer.
      I do not answer questions on behalf of my employer. I'm just a
      programmer helping programmers.
      --
      "Siddharth Jain" <siddharth_jain _1@rediffmail.c om> wrote in message
      news:1117195189 .915999.18340@g 14g2000cwa.goog legroups.com...[color=blue]
      > Hello,
      >
      > Could someone please tell me the history of GUI programming for
      > windows. In the early days, we had to write 100s of lines of code to
      > make a simple dialog box. Then along came MFC to simplify things. And
      > now, finally we have visual C#.NET.
      > Is that right? Is there anything else to it? Can someone please guide
      > me to some link form where I can get to know how things evolved from
      > pre-MFC to MFC to where we are now.
      >
      >
      > Now...here is my problem....I have an application which was made years
      > back. Its GUI has been written using MFC. Now I need to make some
      > changes and make a newer verison of it. But for that I will have to
      > teach myself MFC (I am familiar with C#). The only advantage of using
      > MFC is that MUCH of the earlier code will be reused. Is there any way
      > to get around this? I really wish I could write the GUI in C# and still
      > reuse the code of the precious stuff.
      >
      > Thanks
      > Siddharth
      >[/color]


      Comment

      • Siddharth Jain

        #4
        Re: GUI programming, MFC and C#

        Thanks Nick, that really helped.

        Nick Malik [Microsoft] wrote:[color=blue]
        > Hello Siddharth,
        >
        > Not sure how the history will help you.
        > Xerox PARC came up with the fundamental ideas of the overlapping window.
        > Apple lept on the idea with the LISA and then the Mac, creating a great deal
        > of interest. A number of systems appeared for the DOS platform that
        > provided window-style views, which led to Microsoft developing a number of
        > iterations of a product called Windows that didn't take off until Windows
        > 3.0 came out.
        >
        > At that point, C was the language of choice and there were only a few
        > "controls" that were native to the system.
        > (I wrote one or two C apps to use the first windows interface... it wasn't
        > easy).
        >
        > As Microsoft made the transition to C++, some other folks suggested that the
        > way to open up GUI development was to provide visual designers. The first
        > successful one was Visual Basic. So, around the time that C++ and MFC were
        > getting up steam, VB presented millions of folks with a way to develop GUI
        > apps without writing in either C or C++. Delphi, Powerbuilder, and others
        > took this direction to new heights, and many pre-existing languages like
        > FoxPro added GUI capabilities and took them in new directions.
        >
        > Microsoft added visual designers to C++ through Visual Studio using MFC.
        > Microsoft also pursued the COM architecture and made it trivial to create
        > COM apps in Visual Basic. (It took a bit more work to do COM in C++).
        >
        > Then the Internet came along. Microsoft jumped in with both feet, but it
        > took the invention of Java to really shake things up. Java understood the
        > web inherently, and was small and fast to download. Microsoft came out
        > first with ATL, and then jumped on the Java bandwagon. At one time,
        > Microsoft's JVM was the fastest one available.
        >
        > Microsoft saw the advantages and disadvantages of Java and hired some of the
        > current "bright lights" of programming language development to come to
        > Redmond. They began working on Microsoft's next generation of languages
        > based on the strengths of Java but closer to C++ in style. Then SUN sued,
        > and put Microsoft out of the Java business.
        >
        > Around the same time, Microsoft's efforts came to fruit, and MS put out the
        > .Net framework along with C# and VB.Net and partners that delivered dozens
        > of additional languages. Java is still strong. My personal opinion is that
        > C# is quite strong as well. SUN created a fierce competitor when it decided
        > to kick MS out of the Java game. Only time will tell which will ultimately
        > become a de-facto standard.
        >
        > Now, on to your real problem: None of that matters. You have an app that
        > uses MFC. MFC has no descendents. There is no easy transition from MFC to
        > anything.
        >
        > Depending on the size of your app, you could go one of two ways (a1-a4) or
        > (b):
        >
        > a1) become or hire an MFC and COM expert.
        > a2) Seperate your existing app so that the business logic is different from
        > the GUI code.
        > a3) Put the Business object into COM components that your GUI code calls.
        > a4) Then write a new GUI in C# to call the former systems' business logic.
        >
        > b) start over in C#.
        >
        > The size and complexity of your app will dictate the direction you should
        > take. You may want to outsource (a1-a3) (see RentACoder.Com) and see what
        > comes back. That would give you the ability to do (a4) yourself. You will
        > still need to know COM and MFC to add any new business functionality, but it
        > is a lot easier than starting over and you are less likely to introduce
        > defects. Regression testing is easier as well because, at some point, you
        > can have a C# app and a C++ app side by side and you can see, for yourself,
        > if your new GUI does the exact same things as the old GUI does.
        >
        > Hope that helps,
        >
        > --
        > --- Nick Malik [Microsoft]
        > MCSD, CFPS, Certified Scrummaster
        > http://blogs.msdn.com/nickmalik
        >
        > Disclaimer: Opinions expressed in this forum are my own, and not
        > representative of my employer.
        > I do not answer questions on behalf of my employer. I'm just a
        > programmer helping programmers.
        > --
        > "Siddharth Jain" <siddharth_jain _1@rediffmail.c om> wrote in message
        > news:1117195189 .915999.18340@g 14g2000cwa.goog legroups.com...[color=green]
        > > Hello,
        > >
        > > Could someone please tell me the history of GUI programming for
        > > windows. In the early days, we had to write 100s of lines of code to
        > > make a simple dialog box. Then along came MFC to simplify things. And
        > > now, finally we have visual C#.NET.
        > > Is that right? Is there anything else to it? Can someone please guide
        > > me to some link form where I can get to know how things evolved from
        > > pre-MFC to MFC to where we are now.
        > >
        > >
        > > Now...here is my problem....I have an application which was made years
        > > back. Its GUI has been written using MFC. Now I need to make some
        > > changes and make a newer verison of it. But for that I will have to
        > > teach myself MFC (I am familiar with C#). The only advantage of using
        > > MFC is that MUCH of the earlier code will be reused. Is there any way
        > > to get around this? I really wish I could write the GUI in C# and still
        > > reuse the code of the precious stuff.
        > >
        > > Thanks
        > > Siddharth
        > >[/color][/color]

        Comment

        Working...