CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    May 2010
    Location
    .Net 4.0
    Posts
    58

    Replacing GUI in a Win32 application - best strategy?

    Hello,

    I have a Win32 C++ application which works pretty well, but I don't like the GUI and I want to replace it with one designed graphically, a la Windows Forms. What is the best strategy to port my code? I tried creating a new Windows Forms C++ application and got pretty far with it, but was stymied when trying to call my unmanaged functions on a button press (if anyone knows how to do that, help would be appreciated; I googled and found a lot of admonitions about not mixing managed and unmanaged code). If I can't use Forms to add a GUI without completely rewriting the program, what's my best bet?

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Replacing GUI in a Win32 application - best strategy?

    Mfc

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Replacing GUI in a Win32 application - best strategy?

    Wtl

  4. #4
    Join Date
    Aug 2013
    Posts
    55

    Re: Replacing GUI in a Win32 application - best strategy?

    A good strategy could be to switch to a portable GUI.

    Have a look at primarily wxWidgets but also Qt.

    http://www.wxwidgets.org/
    Last edited by zizz; May 16th, 2014 at 12:45 AM.

  5. #5
    Join Date
    May 2010
    Location
    .Net 4.0
    Posts
    58

    Re: Replacing GUI in a Win32 application - best strategy?

    Of the suggestions above, is it true that only MFC be used to graphically build GUIs within Visual Studio?

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Replacing GUI in a Win32 application - best strategy?

    No
    Victor Nijegorodov

  7. #7
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Replacing GUI in a Win32 application - best strategy?

    Quote Originally Posted by Danja91 View Post
    Of the suggestions above, is it true that only MFC be used to graphically build GUIs within Visual Studio?
    No. It's included with Visual Studio, but the others mentioned will work with it as will .Net and the Windows API.

  8. #8
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Replacing GUI in a Win32 application - best strategy?

    Note that MFC doesn't come with the free Visual Studio Express editions.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  9. #9
    Join Date
    May 2010
    Location
    .Net 4.0
    Posts
    58

    Re: Replacing GUI in a Win32 application - best strategy?

    Thanks to all for your advice. I have so many hours sunk into my Windows Forms application that I've decided to slowly keep chipping away at that. My calls to unmanaged code suddenly started working (I have no idea what I did differently - I suspect that it may have been a Visual Studio bug because all I did was reload the solution) so I'm on my way again. I investigated MFC and WTL as fallback options; thanks for pointing me to them.

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Replacing GUI in a Win32 application - best strategy?

    Quote Originally Posted by Danja91 View Post
    ... My calls to unmanaged code suddenly started...
    Note that MSFT guys call "unmanaged code" as a native one!
    Victor Nijegorodov

  11. #11
    Join Date
    Aug 2013
    Posts
    55

    Re: Replacing GUI in a Win32 application - best strategy?

    Quote Originally Posted by Danja91 View Post
    WTL as fallback
    Although I'm using WTL myself I would describe it as obscure and clandestine. It's mostly for old school die hard Win32 developers who are only comfortable close to the metal. I was about to say that it's hardly ever updated anymore when I found that it recently actually was,

    http://sourceforge.net/projects/wtl/...?source=navbar

    Still I would think twice before I used WTL for new mainstream developments. For native developments (unmanaged code) and if you're not forced to stick to MS technologies I would strongly recommend wxWidgets or Qt. Both are in active development, supported by large communities, free, and most importantly, they're portable. If we're talking strategy the latter is a big point I think.
    Last edited by zizz; May 18th, 2014 at 05:34 AM.

  12. #12
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Replacing GUI in a Win32 application - best strategy?

    Quote Originally Posted by zizz View Post
    Although I'm using WTL myself I would describe it as obscure and clandestine. It's mostly for old school die hard Win32 developers who are only comfortable close to the metal.
    I doubt that many old school die hard Win32 developers who code in straight Win32 would use a framework like WTL. If they did, they wouldn't be old school die hard Win32 developers.

  13. #13
    Join Date
    Aug 2013
    Posts
    55

    Re: Replacing GUI in a Win32 application - best strategy?

    Quote Originally Posted by Arjay View Post
    I doubt that many old school die hard Win32 developers who code in straight Win32 would use a framework like WTL. If they did, they wouldn't be old school die hard Win32 developers.
    You mean it's a contradiction in terms? One cannot be a die-hard Win32 programmer and a WTL user at the the same time?

    Apart from sounding like a die-hard xxxx I think you're dead wrong. WTL is the perfect excuse to cling on to Win32 just a little bit longer.
    Last edited by Arjay; May 18th, 2014 at 06:28 PM. Reason: Removed profanity.

  14. #14
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Replacing GUI in a Win32 application - best strategy?

    Quote Originally Posted by zizz View Post
    ... I think you're dead wrong.
    "wrong" with what?
    Arjay wrote (and it is very clear!) that he doubts...
    Is it equal for you to "be doubt" and to "contradict"?
    Victor Nijegorodov

  15. #15
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Replacing GUI in a Win32 application - best strategy?

    Quote Originally Posted by zizz View Post
    You mean it's a contradiction in terms? One cannot be a die-hard Win32 programmer and a WTL user at the the same time?

    Apart from sounding like a die-hard xxxx I think you're dead wrong. WTL is the perfect excuse to cling on to Win32 just a little bit longer.
    Back off on the insults, Zizz. At any rate, it's been my experience that Win32 programmers that code using a WinProc generally prefer that approach and don't usually move to a framework.

Page 1 of 2 12 LastLast

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