News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

WM_PAINT & InvalidateRect

Started by hotrod, January 23, 2010, 01:28:35 AM

Previous topic - Next topic

Antariy

If use:

invoke RedrawWindow,hStatic,addr rect,0,RDW_ERASE or RDW_INVALIDATE or RDW_UPDATENOW ; UPDATENOW instead


This should force repainting.

hotrod

It appears that you are using a static and trying to clear the text. If so, use an empty string:
QuoteMyString equ "",0

invoke SendMessage,hStatic,WM_SETTEXT,NULL,addr MyString

xandaz

   It crossed my mind hotrod but clearing it seems more better. thanks antariy.

xandaz

   oh yeah btw. It clears the area if i use NULL for window handle when using invalidaterect, but, the whole screen gets updated or something. It's strange.

xandaz

   Not working antariy..Anyone else want to give it a try?
   Thanks for th helpingness.

Antariy

Quote from: xandaz on November 20, 2010, 12:36:36 AM
   oh yeah btw. It clears the area if i use NULL for window handle when using invalidaterect, but, the whole screen gets updated or something. It's strange.

NULL (0) is a handle of desktop - i.e. entire screen. You are repainting all screen then.
My suggestions is followed your code. But you can set new text to static without manual redrawing of it. If you do not use special styles like transparency - this will work fine.

So, instead of:

.code
...
invoke GetClientRect,hStatic,addr rect
invoke RedrawWindow,hStatic,addr rect,0,RDW_ERASE or RDW_INVALIDATE or RDW_ERASENOW ; <--- THIS
invoke SendMessage,hStatic,WM_SETTEXT,NULL,addr MyString


Just:

.code
...
invoke SendMessage,hStatic,WM_SETTEXT,NULL,addr MyString


xandaz

  There's no transparency i think, and dont get me wrong cause i appreciate the help. The thing is that i'm going to display the current directory. if the previous string is longer than the current it will show parts of the previous. Thanks

hotrod

xandaz, you are trying to clear a control by using graphics and I don't think you are not going to be able to isolate the static from the rest of the window. The other possibility is to DrawText on the window and not use a static. You can then clear it with a rectangle.

xandaz

   Your answer seems satisfying enough. i quit. ill use a string.