   My window stops looping when I resize, move, etc
  This has been posted several times on this board in various fashions (but never answered usually the person posting gives up after several suggestions), basically I want my program to keep looping its main code even if someone is moving the window around, scrolling a scroll bar etc...just to give you guys a better understanding of what Im talking about I made a new program in VS2003 windows application, and added a few things so it updates a number counter etc so you can see when its looping my code, if you hold the title bar with your left mouse button the counter will stop, I want the counter to keep going (even if the graphics are not updating) once you let go of the bar the counter will pick up where it left off....Why does windows do this?  Is there anyway around this?edit: to change something that would confuse someone// testdecember.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "testdecember.h" #include <windows.h>#include <stdio.h>#define MAX_LOADSTRING 100// Global Variables:HINSTANCE hInst;// current instanceHWND hWndInformation1;// Handle to first information barint loops;// Number of program loopsTCHAR szTitle[MAX_LOADSTRING];// The title bar textTCHAR szWindowClass[MAX_LOADSTRING];// the main window class name// Forward declarations of functions included in this code module:ATOMMyRegisterClass(HINSTANCE hInstance);BOOLInitInstance(HINSTANCE, int);LRESULT CALLBACKWndProc(HWND, UINT, WPARAM, LPARAM);LRESULT CALLBACKAbout(HWND, UINT, WPARAM, LPARAM);int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR    lpCmdLine, int  nCmdShow){ // TODO: Place code here.MSG msg;HACCEL hAccelTable;// Initialize global stringsLoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);LoadString(hInstance, IDC_TESTDECEMBER, szWindowClass, MAX_LOADSTRING);MyRegisterClass(hInstance);// Perform application initialization:if (!InitInstance (hInstance, nCmdShow)) {return FALSE;}hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_TESTDECEMBER);//message pumpfor(;;){//look for a messageif(PeekMessage(&msg,NULL,0,0,PM_REMOVE)){//there is a message//check that we arent quittingif(msg.message==WM_QUIT) break;//translate messageTranslateMessage(&msg);//dispatch messageDispatchMessage(&msg);}//loop this every time to add +1 and update the display on our windowchar string1[20];sprintf(string1, "LOOP: %i",loops);SendMessage(hWndInformation1, WM_SETTEXT,0,(LPARAM)string1);loops++;//slow it down a bitSleep(30);}return (int) msg.wParam;}////  FUNCTION: MyRegisterClass()////  PURPOSE: Registers the window class.////  COMMENTS:////    This function and its usage are only necessary if you want this code//    to be compatible with Win32 systems prior to the 'RegisterClassEx'//    function that was added to Windows 95. It is important to call this function//    so that the application will get 'well formed' small icons associated//    with it.//ATOM MyRegisterClass(HINSTANCE hInstance){WNDCLASSEX wcex;wcex.cbSize = sizeof(WNDCLASSEX); wcex.style= CS_HREDRAW | CS_VREDRAW;wcex.lpfnWndProc= (WNDPROC)WndProc;wcex.cbClsExtra= 0;wcex.cbWndExtra= 0;wcex.hInstance= hInstance;wcex.hIcon= LoadIcon(hInstance, (LPCTSTR)IDI_TESTDECEMBER);wcex.hCursor= LoadCursor(NULL, IDC_ARROW);wcex.hbrBackground= (HBRUSH)(COLOR_WINDOW+1);wcex.lpszMenuName= (LPCTSTR)IDC_TESTDECEMBER;wcex.lpszClassName= szWindowClass;wcex.hIconSm= LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);return RegisterClassEx(&wcex);}////   FUNCTION: InitInstance(HANDLE, int)////   PURPOSE: Saves instance handle and creates main window////   COMMENTS:////   In this function, we save the instance handle in a global variable and//   create and display the main program window.//BOOL InitInstance(HINSTANCE hInstance, int nCmdShow){   HWND hWnd;   hInst = hInstance; // Store instance handle in our global variable   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);   if (!hWnd)   { return FALSE;   }hWndInformation1 = CreateWindow("Static","LOOP:", SS_LEFT|WS_VISIBLE | WS_CHILD,0,0,125,15,hWnd,NULL,hInstance,NULL);   ShowWindow(hWnd, nCmdShow);   UpdateWindow(hWnd);   return TRUE;}////  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)////  PURPOSE:  Processes messages for the main window.////  WM_COMMAND- process the application menu//  WM_PAINT- Paint the main window//  WM_DESTROY- post a quit message and return////LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){int wmId, wmEvent;PAINTSTRUCT ps;HDC hdc;switch (message) {case WM_COMMAND:wmId    = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections:switch (wmId){case IDM_ABOUT:DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);break;case IDM_EXIT:DestroyWindow(hWnd);break;default:return DefWindowProc(hWnd, message, wParam, lParam);}break;case WM_PAINT:hdc = BeginPaint(hWnd, &ps);// TODO: Add any drawing code here...EndPaint(hWnd, &ps);break;case WM_DESTROY:PostQuitMessage(0);break;default:return DefWindowProc(hWnd, message, wParam, lParam);}return 0;}// Message handler for about box.LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){switch (message){case WM_INITDIALOG:return TRUE;case WM_COMMAND:if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {EndDialog(hDlg, LOWORD(wParam));return TRUE;}break;}return FALSE;}
  I had this same problem in my chess game.  The player's time would not update while the title bar was selected.  So, I put the code that decremented the time in a separate thread and that worked.  Try that.  As to why windows stops looping, I have no idea and would like to know too.   ;  I have had some small weird problems like this also...becuz i used to use ATOM MyRegisterClass(HINSTANCE hInstance);like you did, and now i stoped doing it i dont have those problems...i dunno if it will fix yours but you should maybe give it a try.   ;  the program stops looping cause its busy handling the msgs wm_resize , wm_paintso if you want it to continou to loop then you should call the Render function during those msgs first try calling only during the wm_paint cause it happens in most events and if that didint work out try putting the render function in the other msgs good luck.   ;  Messages which update window position and dimensions have higher priority than WM_TIME or WM_PAINT. Beside creating individual thread, you may create a fake title bar then handle window positioning yourself, which doesn't require a whole lot of work.   ;  I believe the reason the counter isn't being updated is that, during window moves and certain other actions (sliding the scrollbar, etc.), Windows sends the commands directly to the window procedure, bypassing the queue. So, once you click on the title bar, control won't return from DispatchMessage() until the mouse button is released.Given that, your options are as Skeleton_V@T described: create a separate thread for rendering, or fake the titlebar and avoid the message queue.