Win32 Question

Started by
5 comments, last by Aztec 24 years, 1 month ago
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
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.
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.
Essentially WndProc is called when DispatchMessage is. (not quite, but close enough for every day use)
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!!"
ahh, so it''s implicitly called, rather than explicitly.
thanks for the help guys( or gals)!
if you prototype its ass you can probably put it anywhere homes, BUT I DON''T KNOW

- king171@hotmail.com
- http://www.cfxweb.net/mxf/

This topic is closed to new replies.

Advertisement