Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3046

Good reference to C++

$
0
0
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

Viewing all articles
Browse latest Browse all 3046

Trending Articles