Windows Coding Question
I am new to Windows API programming because I usually use MFC for Apps and Glut for OpenGL. But I have a question:
I have a main program loop which takes messages from the que and deals with them ie if escape has been pressed quit the application. I also have a WndProc but why do you need a WndProc when you can use your main program loop in WinMain. Is it because all Window related and process related stuff such as resizing or closing a window can only be caught in WndProc?
Or are all windows messages caught in the programs main loop in WinMain and then sent to WndProc to be handled?
Thanks Alot!!
Hope someone can shed some light on this for me
~Steve~
Edited by - steveharper101 on August 17, 2001 11:10:02 PM
The message loop is a hang over from Windows 1 (16 bit 80286) days. DO NOT PROCESS ANY MESSAGES HERE. Well you can, cus if you screw up and crash the application 32 Windows will clean up all the dead bodies for you.
The wndprocs for each window should handle all the the messages. If you want to exit add the following to your main window proc:
ALL messages go throw the message dispatch, once dispatched they will go to the CORRECT wndproc so that you may process them correctly.
The wndprocs for each window should handle all the the messages. If you want to exit add the following to your main window proc:
|
ALL messages go throw the message dispatch, once dispatched they will go to the CORRECT wndproc so that you may process them correctly.
D.V.Carpe Diem
The message loop is a hang over from Windows 1 (16 bit 80286) days. DO NOT PROCESS ANY MESSAGES HERE. Well you can, cus if you screw up and crash the application 32 Windows will clean up all the dead bodies for you.
The wndprocs for each window should handle all the the messages. If you want to exit add the following to your main window proc:
ALL messages go throw the message dispatch, once dispatched they will go to the CORRECT wndproc so that you may process them correctly.
D.V.
The wndprocs for each window should handle all the the messages. If you want to exit add the following to your main window proc:
|
ALL messages go throw the message dispatch, once dispatched they will go to the CORRECT wndproc so that you may process them correctly.
D.V.
D.V.Carpe Diem
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement