Sign in to follow this  
ov3r_dr1v3

Windows Procedure

Recommended Posts

ov3r_dr1v3    122
Hey, I'm a little confused on the following. If there are 5 windows created(1 main window and 4 child windows), where each window has been created using 5 separate registered windows classes (therefore defining 5 separate Window Procedures), how would this act differently to all 5 windows created using the same registered window class (therefore all sharing the same window procedure). I'd appreciate any input at all thanks

Share this post


Link to post
Share on other sites
popsoftheyear    2194
The answer is: "Not much"

Only now all windows will act the same and have many of the same characteristics of course. Think about an edit control. You my create 10 of them, shape them differently, give them different colors of text, etc., but the internal window procedure used on them that the "edit" class uses causes them all to function pretty much the same.

Anyway it's just a matter of flexibility. If you don't need a different window procedure for each one don't make it.

Cheers
-Scott

Share this post


Link to post
Share on other sites
Aardvajk    13207
In the first case, as each window is sent a message by Windows, each window will have a seperate function to recieve the messages, so each function can perform processing specific to that window.

In the second case, any time each window is sent a message, they messages will be sent to the same function for all five windows. The only difference will be the HWND first parameter to the WndProc, which will refer to the window for who the message is being called.

In the second case you can share processing for similar functions in the single WndProc.

Which is better depends on how similar the windows' behaviours are and the specifics of your application.

(As an aside, having seperate classes does not necessarily mean different WndProcs. It is perfectly acceptable to use one WndProc across several different window classes if you want to. The WndProc is simply the function that gets called when Windows wants to send your window a message.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this