How the processing of WM_InvalidateRect happen ??

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • How the processing of WM_InvalidateRect happen ??

    Hi,
    I am little confused about the processing of WM_InvalidateRect signal. I did some coding and found that processing of WM_InvalidateRect happen at the end of the function. i.e. for example,

    void some_function()
    {
    ....do_something1_
    WM_InvalidateRect(hWin,&Rect);
    ...do_something2..
    ...do_something3...
    }

    Here, I am calling WM_InvalidateRect function after do_something1_,
    WM_InvalidateRect sends the signal to window to update the specified area right ? but here controller doesn't jumps to WM_PAINT as soon as this Invalidate API is called.. It first processes do_something2 & do_something3 and then it jumps to WM_PAINT event.
    so In short current behaviour is :
    1) do do_something1_
    2) Invalidate the rect
    3) do do_something2_
    4) do do_something3_
    5) Repaint the window

    Is it the correct behaviour ??



    how can i achieve behaviour like this :

    1) do do_something1_
    2) Invalidate the rect
    3) Repaint the window
    4) do do_something2_
    5) do do_something3_
  • Hi,

    Please try to add a GUI_Exec() after the WM_InvalidateRect() like below. WM_InvalidateRect() marks a specific area as invalid and by the next call of GUI_Exec() it gets redrawn. GUI_Exec() is also called by GUI_Delay().

    void some_function()
    {
    ....do_something1_
    WM_InvalidateRect(hWin,&Rect);
    GUI_Exec();
    ...do_something2..
    ...do_something3...
    }

    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.