Thread: C++ moving to MFC

  1. #1
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483

    C++ moving to MFC

    I think i've covered most of the things in C++ and planning on moving to MFC.

    What this are a MUST in MFC and what things will help?

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    NOOOOOO!
    Forget MFC. Learn windows API and write your own classes that suit your needs. Its a great learning exercise. For some examples have a look at Kens site .
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    May 2005
    Posts
    9
    i completely agree... MFC is hated

  4. #4
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    I've had a little taste of Win32 but it seems too much coding and a lot of it just doesn't make much sence.

    MFC seems to be a lot shorter and well doesn't make much sence but then again i haven't really read anything about it.

  5. #5
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    I haven't used MFC. I assume, like the WinAPI, it's like learning a new programming language... So, you don't need to know that much standard C++ to use it. To use the API, you mainly need to understand variables, (including constants & typedefs), pointers, structures, functions, and loops. I'm not sure if you need a good understanding of classes to use MFC.

  6. #6
    Registered User
    Join Date
    Jan 2003
    Posts
    78
    MFC will save you a ton of time over straight API. It does similar for C++ what VB does for BASIC. The learning curve is a bit steep at first. Check out codeproject dot com.

  7. #7
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    I think i've covered most of the things in C++ and planning on moving to MFC.
    What this are a MUST in MFC and what things will help?
    MFC will help you write window gui applications.

    I assume, like the WinAPI, it's like learning a new programming language... So, you don't need to know that much standard C++ to use it.
    You'll probably want to use standard C++ for most of your application. The use of the library itself isn't standard, but is epected. And, whether you want to use std::string or CString, std::vector, std::list, std::deque or the MFC alternatives, is up to you. I'd learn to use CString because of the unicode support. The other containers MFC offers are awkard compared to the STL, and probably aren't worth learning unless if a lot of code is written using them.


    To use the API, you mainly need to understand variables, (including constants & typedefs), pointers, structures, functions, and loops. I'm not sure if you need a good understanding of classes to use MFC.
    Yes, you'll need to know about classes. A lot of the message handler stuff can be done within the app wizard.

  8. #8
    Registered User
    Join Date
    Jan 2003
    Posts
    78
    Quote Originally Posted by okinrus
    Yes, you'll need to know about classes. A lot of the message handler stuff can be done within the app wizard.
    You can actually get away with very little formal C++ OOP knowledge. IMO, that is one of the down sides. MFC has been criticized often because it disregards many of the conventions of object oriented programming to make it easier to squeeze out running code quickly. So in reference to the statement that you need to know about classes, yes, but not for the reasons one may initially think.

    I have used MFC many times in the past because the message map macros alone provide a significant reduction in the number of lines of code I need to write. I can knock out a functional GUI using MFC almost as fast as I can using VB. I hate writing VB code. MFC gives me the same advantages (almost) as VB, and I can write code in my preferred language. I try to make my code as robust as I can, but there isn't much I can do about the framework code.

    For anyone starting out learning MFC, I recommend digging right into the message maps. Read the Technotes and everything you can find in MSDN pertaining to message handling. Once you have a grasp on how the message pump and message map macros work you're 66.6% of the way to having MFC mastered.

    -Rog

  9. #9
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    I've had a little taste of Win32 but it seems too much coding and a lot of it just doesn't make much sence.
    Then expect MFC to completely bamboozle you. There are so many gaps in the classes available that often you will need to know the API anyway to accomplish what you want in MFC. So even if you do have your heart set on learning MFC then I would always start first with the API. Get Petzold's programming windows and work through that and then you are ready for Richter's advanced windows programming. Once you have mastered what Richter shows you then you can move on confidently to MFC though by then I doubt you would want to anymore. Prosise's programming windows with MFC is a good book for MFC. MFC is not the shortcut to windows programming that many believe it is due to such crap works as learn visual c++ in 21 days.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  10. #10
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    You can actually get away with very little formal C++ OOP knowledge.
    Understanding the semantics of C++ classes is almost essential to use a library with C++ classes.

    MFC has been criticized often because it disregards many of the conventions of object oriented programming to make it easier to squeeze out running code quickly.
    MFC's message system creates unexpected behavior because non-mfc programmers are used to designing their classes and then extending them using virtual methods. MFC, however, uses it's own message system, although the MFC docs try to justify it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM
  2. Release MFC Programs & Dynamic MFC DLL :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-18-2002, 06:42 PM
  3. Understanding The Future of MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 04-15-2002, 09:08 PM
  4. Beginning MFC (Prosise) Part III - Now What? :: C++
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 03-03-2002, 06:58 PM
  5. MFC is Challenging :: C++
    By kuphryn in forum C++ Programming
    Replies: 8
    Last Post: 02-05-2002, 01:33 AM