   using spacebar to control loop
  if I have  a game loopwhile(getmessage()){update();render();}I key spacebar to render a image. pause, and then I key spacebar againthe loop above go a  step again and so on.how to do it?   
  Assuming I understand you correctly:// Global:bool DoUpdate=0;// Main loopwhile(getmessage()){if(DoUpdate){    update();}render();}// In Windows Message Handler, edit to be yours.LRESULT CALLBACK WndProc (HWND winobj, unsigned int message, WPARAM wParam, LPARAM lParam){// ...case WM_KEYUP:    switch (wParam){   case 0x08:   // Space.  DoUpdate=!DoUpdate;// Toggle Flag.  return(0);    // Handled.   // Other keys.    }    return( DefWindowProc(winobj,message,wParam,lParam) );// ...};  If I follow peak for messages rather than waiting for a message. If a message is pending then go ahead and read/process it. If there is no message then update if needed then render.   