Thread: Refresh Window with timer

  1. #1
    Registered User
    Join Date
    Nov 2005

    Smile Refresh Window with timer

    I have a Window created on an embeddeed system. In the Window is a progressbar that is moving. After a while, the screen turns black and only the progress bar is visible. I think it has to do with the environment somehow. I want my WIndow to be visible and have an idea that it could be done with a timer. However, I haven't programmed C in WIndows so much so I'm slightly green.

    What do I need to do to get my Window refreshed over and over again, lets say every 15th second?

    Do I need to do something with the callback procedure, or can I get another one for the timer? My program looks something like this:

    HWND hCurPage = NULL;
    LRESULT CALLBACK WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
      switch( uMsg )
      case WM_INITDIALOG:
    	return TRUE;
      case WM_DESTROY:
        PostQuitMessage( 0 );
        return( DefWindowProc( hwnd, uMsg, wParam, lParam ) );
      return 0;
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    	LPSTR lpCmdLine, int nCmdShow)
    hCurPage = CreateDialog (hInst, MAKEINTRESOURCE(IDD_DIALOG_WINDOW), NULL, (DLGPROC) WndProc);
    return 0;

  2. #2
    Registered User
    Join Date
    Sep 2004
    windows automatically get refreshed when they need to. It sounds to me like you are blocking your message pump somehow. Are you sure that you need to call CreateDialog() and not DialogBox()? If so, where are you calling IsDialogMessage()?

  3. #3
    Registered User
    Join Date
    Jan 2005
    If your program is doing a lot of work then this should be done in a seperate thread while your main thread keeps handeling window messages.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM