CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2009
    Posts
    31

    Good reference to C++

    Hi, I used to be pretty good with MFC, 25 years ago, but now there does not appear to be MFC any longer. I'm working with VS 2022. So since I had to never deal with the message pump and starting the class I am a little out of my comfort zone.

    Is there a good reference to show me how I would instanciate the main window for the class from the application entry point? Trying to generate a C++ Dialog window for a small project I'm working on at work.

    Like I said.... I used to be fairly good with MFC but that apparently is a different beast all together.

    Code:
    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
        switch (message)
        {
        case WM_COMMAND:
            {
                int wmId = LOWORD(wParam);
                // Parse the menu selections:
                switch (wmId)
                {
                case IDM_ABOUT:
                    DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                    break;
                case IDM_EXIT:
                    DestroyWindow(hWnd);
                    break;
                default:
                    return DefWindowProc(hWnd, message, wParam, lParam);
                }
            }
            break;
        case WM_PAINT:
            {
                PAINTSTRUCT ps;
                HDC hdc = BeginPaint(hWnd, &ps);
                // TODO: Add any drawing code that uses hdc here...
                EndPaint(hWnd, &ps);
            }
            break;
        case WM_DESTROY:
            PostQuitMessage(0);
            break;
        default:
            return DefWindowProc(hWnd, message, wParam, lParam);
        }
        return 0;
    }
    Where does the class go to initiate the process? Thanks for the help

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

    Re: Good reference to C++

    A good resource is http://www.flounder.com/ look under mvp tips.

    But MFC is still available. You have to specifically install it with the VS installer. It's not installed by default.

    The classic windows book is Programming Windows by Charles Petzold
    https://www.amazon.co.uk/Programming...95X/ref=sr_1_1

    There's also MS own tutorials
    https://learn.microsoft.com/en-us/wi...am-for-windows
    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)

  3. #3
    Join Date
    Feb 2009
    Posts
    31

    Re: Good reference to C++

    Quote Originally Posted by 2kaud View Post
    A good resource is http://www.flounder.com/ look under mvp tips.

    But MFC is still available. You have to specifically install it with the VS installer. It's not installed by default.

    The classic windows book is Programming Windows by Charles Petzold
    https://www.amazon.co.uk/Programming...95X/ref=sr_1_1

    There's also MS own tutorials
    https://learn.microsoft.com/en-us/wi...am-for-windows
    Awsome, Thanks! I'll get IT to install the package then I'll have less issues with coding. Will still come back for advise, but can get a lot further with MFC.

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

    Re: Good reference to C++

    Quote Originally Posted by 2kaud View Post
    A good resource is http://www.flounder.com/ look under mvp tips.

    it's my favorite site about MFC!
    And here is the author Joe Newcomer sitting at the table (‎April ‎22, ‎2008, Redmond WA): Attachment 36133
    Victor Nijegorodov

  5. #5
    Join Date
    Feb 2009
    Posts
    31

    Re: Good reference to C++

    Quote Originally Posted by VictorN View Post

    it's my favorite site about MFC!
    And here is the author Joe Newcomer sitting at the table (‎April ‎22, ‎2008, Redmond WA): Attachment 36133
    I remember back in the day borrowing a few snipits of code from him. It was around 98. I believe that was him anyway.

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