-
March 11th, 2025, 11:10 AM
#1
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
-
March 11th, 2025, 11:40 AM
#2
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)
-
March 11th, 2025, 12:24 PM
#3
Re: Good reference to C++
 Originally Posted by 2kaud
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.
-
March 11th, 2025, 02:06 PM
#4
-
March 11th, 2025, 02:58 PM
#5
Re: Good reference to C++
 Originally Posted by VictorN

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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|