Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Aztec

Win32 Question

This topic is 6646 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

okay, i''ve started to learn the basics of win32 stuff... how and when does WindProc get called? in WinMain, it''s never directly called, and in the doInit function it doesn''t call it, yet the code gets executed. I''m rather confused by this :/ thanks for the help

Share this post


Link to post
Share on other sites
Advertisement
I''m not to good at explaining things but here is generally what happens:

When you created the window class you specified a window procedure function. You then registered your class (RegisterClass). Next you most likely created a window. In the CreateWindow funciton one of the parameters is a window class. You obviously specified the class you just registerd.

Whenever the OS needs an application to handle a message it looks to see what class the window is and then uses that class''s procedure function.

Share this post


Link to post
Share on other sites
It sounds as though you''re asking about a particular piece of code, but it should work the same for any win32 program. You register the function in the window class (WNDCLASSEX.lpfnWndProc). Then the function is called by the os when a message is sent to the window.

Share this post


Link to post
Share on other sites
Essentially WndProc is called when DispatchMessage is. (not quite, but close enough for every day use)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''ve had the same curiosity when I first started programming for Windows. If you look hard, it''s there... The WinProc function gets called somewhere buried deep in some other Win32 function Microsoft already designed... My suggestion is that you don''t lose your sleep on it and concentrate on your other programming issue. It''s like asking "Why do flowers bloom in Spring?" Your answer should be "I DON''T KNOW and I don''t care!!"

Share this post


Link to post
Share on other sites
ahh, so it''s implicitly called, rather than explicitly.
thanks for the help guys( or gals)!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!