News:

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

Text Doesn't Refresh

Started by asmftw, September 30, 2007, 08:31:40 PM

Previous topic - Next topic

asmftw

Hello, I have a window created with CreateWindowClassEx and it has text on it. When I change the text, it does not appear until it gets the WM_PAINT command. If I manually set WM_PAINT with SendMessage, PostMessage, or UpdateWindow, it does not update. I've tried about 500 ways to make the window text update without hiding it and showing it and none worked so far. The text is created with TextOut if that helps. Please help I've been trying to fix this for 4 days now and have had no progress.

Synfire

Did you try GetWindowRect and InvalidateRect APIs?

asmftw

I tried that, It wont work either.

raymond

QuoteWhen I change the text

You don't have to wait for the WM_PAINT to modify the content of the screen unless your procedure for changing the text to something else is also part of the WM_PAINT code. Simply send the TextOut message wherever you modify the text in your code.

(Keep your refresh code in the WM_PAINT portion for refreshing whenever the window may be minimized, or resized, or whatever.)

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

Tedd

You can't send a WM_PAINT message - it's not a 'real' message in that sense. You receive WM_PAINT only when your message queue has been emptied and there is at least one invalid region.
Though you can use UpdateWindow to force a WM_PAINT, but it will still not update unless there is an invalid region to update.
So, modify your text, then call InvalidateRect(hwnd,0,TRUE) -- this will force the whole window's client area to be invalidated, and it will be updated at the next WM_PAINT. If you can't wait for the WM_PAINT (unless you need to update really fast, you can usually wait) then you can call UpdateWindow after that.
If you still can't get it to work, it's easier if you post the full code :wink
No snowflake in an avalanche feels responsible.