![]() |
Windows Encapsulation
This maybe a dumb question, but I was thinking of making a header that pretty much takes care of the windows message procedure (execpt of course, wm_command) and a few other things for me so my code will be more readable. Although, I just started learning windows programming last year and am still kinda getting the hang of it, so I thought it might be good practice for me to get used to typing out and seeing that redunant code, so I could learn it. What do you think? Should I hide the windows code in a class to make things easy or leave it how it is?
|
You only need to type out code in the message handler if you really need it. There are some [semi-]obligatory parts of the message handler (WM_QUIT and WM_CLOSE really), but if you aren't going to respond to a message or don't really care about it, let DefWindowProc handle it.
If you just want to make your message handler look better, check out the Message Cracker macro's in windowsx.h. |
Thanks, I'll check it out. I was just going to encase some redunant code in a class just to make it easier for people to read. Because people complain when you shove too much code in one place.
|
Quote:
|
It's just easier on the eyes. I have some friends who aren't great with windows api, or C++ in general. It's best I can show them better organized code so they can understand...
|
encapsulation, the word sucks. To make a long tip short stick to the Windows API or Microsoft MFC. It's a pain in the ass to encapsulate the Windows API. I'm taking this from experience.
|
Encapsulation is great. I take my vitamins by swallowing one gelatin thangy instead of trying to pick up all those tiny little flecks of this and that. I work on my carburetor by removing one assembly from one place instead of having to take part from my hood ornament, part from my trunk, and part from my turn signal. If someone represents sticking a sow's ear up a hog's ass and coming out with a silk purse as a fait accompli, well, that's just a bad job and a typical huckster's approach. Don't mistake the two.
|
Quote:
|
When I saw the plaid jacket and white shoes, I left. One needs to develop discernment. Who wants to traipse around the world yelling, "Hey, Bob", "Hey, Bob" when unthinking echoes are so cheap.
|
Quote:
Quote:
Quote:
Okay... That's one way of saying encapsulation is very useful... 0.o :confused: |
| All times are GMT -5. The time now is 12:23 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC