C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-21-2007, 03:51 PM   #1
Registered User
 
Join Date: Dec 2006
Posts: 47
Message loop?

I am having a bit of trouble understanding why the message loop is important. So lets say the user types in A which goes into the message queue. THEN the message loop takes it and then sends it back? This is the part I don't understand. Why does it send it back to windows. Wouldn't it be simpler just to have windows either send it directly to windows procedure OR have message loop send it to the windows procedure?
Shadowwoelf is offline   Reply With Quote
Old 07-21-2007, 04:58 PM   #2
Registered User
 
Join Date: Jul 2007
Posts: 36
The message loop blocks execution (duh) so that ProcessMessage() can process the messages of the window. This involves drawing the window or windows and processing other controls. I could if I wanted create GUI system but if I want the window to stay open until it is closed I need some way of continuously drawing it and processing its messages. If there is no message loop the window will only be drawn once and its messages processed once. I think windows has too much to do to worry about processing windows. Besides, you want the window to run in the application's thread, not the systems.
francoissoft is offline   Reply With Quote
Old 07-21-2007, 09:58 PM   #3
int x = *((int *) NULL);
 
Cactus_Hugger's Avatar
 
Join Date: Jul 2003
Location: Banks of the River Styx
Posts: 902
Winprog has a page with just your question.
__________________
long time; /* know C? */
Unprecedented performance: Nothing ever ran this slow before.
Any sufficiently advanced bug is indistinguishable from a feature.
Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
The best way to accelerate an IBM is at 9.8 m/s/s.
recursion (re - cur' - zhun) n. 1. (see recursion)
Cactus_Hugger is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Desperate Over Ecs! cookie C Programming 17 07-16-2008 01:25 PM
Window message loop (Keys) Blackroot Windows Programming 3 09-12-2006 05:15 PM
Scope And Parameter Passing djwicks C Programming 6 03-28-2005 08:26 PM
Help, the window gets killed...... incognito Game Programming 2 05-28-2002 02:22 PM


All times are GMT -6. The time now is 02:23 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22