Refreshing Window

This is a discussion on Refreshing Window within the Windows Programming forums, part of the Platform Specific Boards category; I have a windows program: Code: int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { ... hCurPage = ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    41

    Refreshing Window

    I have a windows program:


    Code:
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,  LPSTR lpCmdLine, int nCmdShow)
    {
    
    
    ...
    
    hCurPage = CreateDialog (hInst, MAKEINTRESOURCE(IDD_DIALOG_WINDOW), NULL,  (DLGPROC) WndProc);
    
    	ShowWindow(hCurPage, SW_SHOW);
    
    ...
    }
    After the CreateDialog call, the window comes up, but it doesn't seem to refresh itself. I have one meter, some text and a bitmap-picture on it. How do I refresh it? Can I use the SHowWindow callagain? Could I set a timer to call it over and over again?

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    Code:
    InvalidateRect(hwnd,NULL,true);
    UpdateWindow(hwnd);
    hwnd being the window you want to force to update.

    InvalideRect with the parameters shown above will force a full redrawing of the window. UpdateWindow forces it to happen right then.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    If you call CreateDialog() to show your dialog, then you need still need to have a message loop somewhere where you call IsDialogMessage(). Is it your intention to create a modeless dialog, or are you just trying to create a dialog application?

    If you are just trying to create a dialog application, then use the function DialogBoxParam() instead of CreateDialog().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 07:14 AM
  2. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  3. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 10:06 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM

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