Thread: How do I use MFC in Visual C++ 2008?

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    31

    Question How do I use MFC in Visual C++ 2008?

    I am having difficulty making a simple MFC based program on Microsoft's VC++. I don't like the wizard junk. I want to be completely in charge of the header files being used. I want to have direct, simple control over my programs.

    Is there a way that I can simpley include the MFC's into my program, without wizards, or DLLs?

  2. #2
    Registered User
    Join Date
    Jan 2009
    Posts
    31
    It sounds like The files needed for MFC, are not included with Microsoft's Visual C++ express edition. Is that true?

    If so, is there a way of obtaining the MFC files for cheap?

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    1) Yes.
    2) No.
    MFC isn't free - it comes with the Professional edition. Though if you are a student, you can get it for free at Dreamspark.
    Also, you SHOULD use the Wizard for generating an MFC app since it generates the absolute minimum code to get your MFC app to work.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    31

    Smile

    Quote Originally Posted by Elysia View Post
    1) Yes.
    2) No.
    MFC isn't free - it comes with the Professional edition. Though if you are a student, you can get it for free at Dreamspark.
    Cool, I am not an official student anywhere, but I am studying at home. Is there any way that I could be verified as a student?

    Quote Originally Posted by Elysia View Post
    Also, you SHOULD use the Wizard for generating an MFC app since it generates the absolute minimum code to get your MFC app to work.
    Where can I see what elements are included from MFC, when using the wizard?

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by RaisinToe View Post
    Cool, I am not an official student anywhere, but I am studying at home. Is there any way that I could be verified as a student?
    I don't know. You should try.

    Where can I see what elements are included from MFC, when using the wizard?
    Not sure what you mean?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User
    Join Date
    Jan 2009
    Posts
    31
    I just mean, what are the pieces from MFC that I can use right now?

    I mean, what are the classes that I can use from MFC right now?

    I ask, what are the pieces that I can use, because I suppose that some of the classes may not be complete. Are all of the classes complete that are included with the express version, ( using the wizard of course )?

    I am just asking, "what am I able to use from the MFCs with the express edition?"

  7. #7
    Registered User
    Join Date
    Jan 2009
    Posts
    31
    I guess I am getting the wrong idea. I just need to take a look at the code that is generated by the wizard.

  8. #8
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    Quote Originally Posted by RaisinToe View Post
    I am just asking, "what am I able to use from the MFCs with the express edition?"
    As it comes, none, none at all. You can get some MFC headers and libs for free, albeit for an older version (4.2), by downloading the WDK package from Microsoft Connect. That's all you get though, no examples or IDE intergration.

    That said, if you're not eligible to get VS pro for free, there is a 90-day trial from which you can gather the info you require.

  9. #9
    Registered User
    Join Date
    Jan 2009
    Posts
    31
    I am having trouble getting onto the Microsoft web site today. Is everyone else having the same problem?

  10. #10
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Nope. Seems fine to me.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Registered User
    Join Date
    Jan 2009
    Posts
    31
    Quote Originally Posted by adeyblue View Post
    That said, if you're not eligible to get VS pro for free, there is a 90-day trial from which you can gather the info you require.
    Thank you, I got the 90-day trial downloaded now. I had to virtualy mount the ISO file, so it is taking up 3.31 GB of space on my computer. Can I get rid of it, now that I have used it to download the program? (that is, if I don't want to download anything else from it).

    Also, I am still having dificulty finding a way to build a simple program. I want to learn simple MFC programs from the ground up, but there is still more reqired by Microsoft's VS to create an MFC application. For example, I received an error message that stated that I need to #define _AFXDLL. I am trying to figure out what that means, (I am still a begginer). I want to stay away from the wizards for learning purposes. You will all think it is a waste of time to build without the wizards, I know, but can you please help me learn how to create a simple, strait-forward MFC application?

    Thank you everyone for all of your help.

  12. #12
    Registered User
    Join Date
    Jan 2009
    Posts
    31
    I wanted to add the code here, so you can see what I was trying to do.

    Code:
    // A minimal MFC program.
    #include <afxwin.h>
    
    // Derive essential classes.
    
    // This is the main window class.
    class CMainWin : public CFrameWnd
    {
    public:
      CMainWin();
      DECLARE_MESSAGE_MAP()
    };
    
    // Construct a window.
    CMainWin::CMainWin()
    {
      Create(NULL, "An MFC Application Skeleton");
    }
    
    // This is the application class.
    class CApp : public CWinApp
    {
    public: 
      BOOL InitInstance();
    };
    
    // Initialize the application.
    BOOL CApp::InitInstance()
    {
      m_pMainWnd = new CMainWin;
      m_pMainWnd->ShowWindow(m_nCmdShow);
      m_pMainWnd->UpdateWindow();
    
      return TRUE;
    }
    
    // This is the application's message map.
    BEGIN_MESSAGE_MAP(CMainWin, CFrameWnd)
    END_MESSAGE_MAP()
    
    CApp App; // instantiate the application

  13. #13
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by RaisinToe View Post
    Thank you, I got the 90-day trial downloaded now. I had to virtualy mount the ISO file, so it is taking up 3.31 GB of space on my computer. Can I get rid of it, now that I have used it to download the program? (that is, if I don't want to download anything else from it).
    Sure, you can delete it.

    Also, I am still having dificulty finding a way to build a simple program. I want to learn simple MFC programs from the ground up, but there is still more reqired by Microsoft's VS to create an MFC application. For example, I received an error message that stated that I need to #define _AFXDLL. I am trying to figure out what that means, (I am still a begginer). I want to stay away from the wizards for learning purposes. You will all think it is a waste of time to build without the wizards, I know, but can you please help me learn how to create a simple, strait-forward MFC application?
    I don't know if anyone knows how to do it group-up. The simple fact is that the Wizard generates the minimum amount of code to get started, so use it.
    From there, you can customize your app to your needs. It is not a bad thing to rely on the Wizard.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #14
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Doing MFC without the wizards is extremely painful. There is a lot of redundant code that you will get tired of typing over and over and over again.

  15. #15
    Registered User
    Join Date
    Jan 2009
    Posts
    31

    Question

    Quote Originally Posted by Bubba View Post
    Doing MFC without the wizards is extremely painful. There is a lot of redundant code that you will get tired of typing over and over and over again.
    Is a lot of the extra code needed because of the way Visual Studio is set up? Or is it just the typical MFC code that you are talking about?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM

Tags for this Thread