Jump to content
  • Advertisement
Sign in to follow this  
ov3r_dr1v3

Windows Procedure

This topic is 3558 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!