Thread: Window just won't update!

  1. #1

    Window just won't update!

    I have a window. When a message is sent to it I process the message and then I want to redraw the window.

    So. I do the following --

    InvalidateRect( hwnd, NULL, FALSE );
    UpdateWindow( hwnd );

    And suprise suprise it doesn't update!! Why? Depending on the information this window has it will draw differently. In this message I have changed a variable and so the window should look different. I've even tested the variable and it's right!

  2. #2
    Registered User filler_bunny's Avatar
    Join Date
    Feb 2003
    Posts
    87
    The variable is declared outside of the case block and is declared as static?
    Visual C++ .net
    Windows XP profesional

  3. #3
    It's not a problem with the variable. At least it shouldn't be. It works on other update times but just not on this specific one which is really weird....

  4. #4
    Registered User filler_bunny's Avatar
    Join Date
    Feb 2003
    Posts
    87
    Can you post a short bit of code that demonstrates the problem?
    Visual C++ .net
    Windows XP profesional

  5. #5
    Code:
    case MCC_ADDTAB: {
              
              if( ts->active >= 0 ) {
                ShowWindow( ts->pages[ts->active], SW_HIDE );
              }
              ts->active++;
              ts->nTabs++;
              ts->ids = (int*)realloc( ts->ids, ts->nTabs*sizeof(int) );
              ts->titles = (LPSTR*)realloc( ts->titles, ts->nTabs*sizeof(LPSTR) );
              ts->pages = (HWND*)realloc( ts->pages, ts->nTabs*sizeof(HWND) );
              ts->ids[ts->nTabs-1] = lParam;
              ts->titles[ts->nTabs-1] = (LPSTR)wParam;
              ts->pages[ts->nTabs-1] = CreatePage( hwnd, 1 );
              ts->set = true;
              SendMessage( GetParent( hwnd ), MCC_TABSEL, (WPARAM)ts->titles[ts->active],(LPARAM)ts->active );
              InvalidateRect( hwnd, NULL, FALSE );
              UpdateWindow( hwnd );
              return 0;
            }
    In my WM_PAINT function depending on the value of ts->active it'll do something different. It works if I set it in other message cases but not this one for some weird reason.

  6. #6
    No matter I've fixed it... somehow. :\

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. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM