   Waiting for input in a continous loop game
  I''m programming a game/editor in windows.  Using a variety of techniques I stole from a variety of places, I managed to tweak windows to run the game loop as a non-event driven thing.Okay, now here''s the problem.  Say I want the user to put in input, and for the game/editor to wait for them to do so.  What I basically have so far for the editor:Game_Loop enters into one of several editing modes if there are no events in que.One mode prompts the user.  I want the editor to do nothing in the mean time.  Easy, I just put a wait_for_input flag in my event que.  Everything halts (but allows message processing) while I wait for input.  It finally get''s resolved, there''s input ready, great...How do I pick up in the mode where I left off?  Or is there a better way to do this?Let''s keep in mind that my knowledge of windows programming is limited to being able to copy from other people''s programs.  I need a wait for input function that would still cycle through the main windows loop and handle messages.  Any thoughts would be appreciated. 
void DoMessageLoop(){while (PeekMessage(&msg, m_hWnd, 0, 0, PM_REMOVE)){TranslateMessage(&msg);DispatchMessage(&msg);}}Is that what you meant? or do you mean that you go to a ''wait-for-input'' mode, and then when the input arrives you want to switch back to the mode you were in? In that case, store a ''currentmode'' and ''nextmode'', and when you finish up with ''currentmode'' just switch to ''nextmode''. ;  if your problem is just keeping track of your mode you can either make it easy, use states and do one huge switch-block or (more elegant) use classes as states, like so:class BaseState {public: virtual void Input()=0;};thenclass StateModeX : public BaseState {public: virtual void Input();} ModeX;void StateModeX::Input() {//do stuff}in your main loop youd have a pointer/referenceBaseState& Mode=ModeX;and within the loop you callMode.Input();and at any time you can change the modeMode=ModeY;in the end its the same, just not as messy as endless cases for every single state/mode. 