Thread: using InvalidateRect()

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    106

    using InvalidateRect()

    ok, i've got a section of my window that i need to reprint with each iteration of my main while loop, and i've created a rectangle to invalidate (declared it, put in the coordinates). its name is "rect". so, i then make the following call:

    Code:
    InvalidateRect(hwnd,rect,TRUE);
    however, it gives me the following error upon compilation:

    Code:
    'InvalidateRect' : cannot convert parameter 2 from 'struct tagRECT' to 'const struct tagRECT *'
    not sure whats going on, i just started programming win32 a few days ago, not exactly good yet. any help would be greatly appreciated. thanks a lot.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    &rect
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    106
    awesome, thanks a lot

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    106
    hmm...still not working.

    heres what i've got...

    Code:
    RECT rect={420,0,450,50};
    
    ............
    
    InvalidateRect(hwnd,&rect,TRUE);
    and it still does not redraw the rectangle within those coordinates. any ideas? thanks.

  5. #5
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    post your code. If large zip it up and attach.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Add an UpdateWindow() after you have invalidated a region to tell windows to redraw.

    Use GetUpdateRect() in your WM_PAINT handler to recieve this area.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #7
    Registered User
    Join Date
    Aug 2001
    Posts
    106
    nevermind, i got it working.
    thanks guys.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Invalidaterect
    By Ducky in forum Windows Programming
    Replies: 10
    Last Post: 10-26-2008, 03:12 PM
  2. Replies: 12
    Last Post: 05-28-2008, 04:10 AM
  3. Is InvalidateRect the correct API?
    By Joelito in forum Windows Programming
    Replies: 6
    Last Post: 05-15-2007, 07:44 AM
  4. New to Windows & C++ - InvalidateRect Problem
    By Guardian in forum Windows Programming
    Replies: 1
    Last Post: 04-23-2002, 11:26 PM
  5. ValidateRect() and InvalidateRect()
    By Garfield in forum Windows Programming
    Replies: 6
    Last Post: 11-01-2001, 12:04 PM