Monday, May 24, 2010

Starting C++ windows programming: frustrating me?

I have got a good handle on dos programming so now I'm starting windows programming. On the first section of the tutorial (message boxes) I was fine. But when I went on the to the second section there was all this crap: http://www.winprog.org/tutorial/simple_w...





The first section was easy but in just advancing one there was so much.


Do I have to memorize all of this? If I do, then can anybody


give me a good method for doing so?

Starting C++ windows programming: frustrating me?
When creating a windowed application in Dev-C++ the editor will place this code for you. But it doesn't hurt to understand how things work and how to manipulate them.
Reply:That is the old SDK C coding method of writing a windows application. So if you want to learn that methodology, then yes, you will need to memorize that every WinMain that displays a window will need a message loop, and every window needs a WndProc to process the event driven messages. Then you will need to learn the hundreds of messages that can be sent to the WndProc based on what you are doing like WM_RESIZE for when the window was resized, WM_CREATE for when the window is created, WM_PAINT for drawing in the window,... Everyone of these messages has an LPARAM and WPARAM which are different based on each message set to the WndProc.





Back when I worked for a CAD company, our main WndProc function was like 2000 lines long, and each pretty much only called a function:





case WM_CREATE:


doCreate();


break;





My advice is to pick a tool that abstracts all this.
Reply:Simpler if you go with MFC, GUI programming is not standardized and most would tell you to use Resource tools like Visual Studio.


No comments:

Post a Comment