![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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?
|
|
|
|
#2 |
|
Hobbyist Programmer
|
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. |
|
|
|
|
|
#3 |
|
Guest
Posts: n/a
|
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.
|
|
|
|
#4 | |
|
Professional Programmer
|
Quote:
__________________
The world's first athletic computer geek! The home of PrProgramsStudios How not to post a question: <-- Please don't reply |
|
|
|
|
|
|
#5 |
|
Guest
Posts: n/a
|
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...
|
|
|
|
#6 |
|
Hobbyist Programmer
Join Date: Oct 2005
Location: Ohio
Posts: 177
Rep Power: 0
![]() |
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.
|
|
|
|
|
|
#7 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#8 | |
|
Hobbyist Programmer
Join Date: Oct 2005
Location: Ohio
Posts: 177
Rep Power: 0
![]() |
Quote:
|
|
|
|
|
|
|
#9 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#10 | |||
|
Guest
Posts: n/a
|
Quote:
Quote:
Quote:
Okay... That's one way of saying encapsulation is very useful... 0.o ![]() |
|||
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|