|
-
October 1st, 2005, 01:53 PM
#1
Can't force window repaint?
Hi guys,
I am to be king of odd problems!
I want MY application to force ANOTHER process window to repaint. I figure this should be easy!
I try all of these:
Code:
InvalidateRect(hwnd, NULL, TRUE);
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW | RDW_UPDATENOW | RDW_INTERNALPAINT);
UpdateWindow(hwnd);
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
None force repaint! But, if I click in process window, then set focus somewhere else (eg, click on task bar), then click back in process window, repaint happens.
Any idea?
Thanks!
-
October 1st, 2005, 11:53 PM
#2
Re: Can't force window repaint?
Try to send the WM_PAINT message.
Hope it will help you
-
October 2nd, 2005, 02:59 AM
#3
Re: Can't force window repaint?
InvalidateRect() and sending a WM_PAINT message are equivalent methods. I suppose the problem is that you program does not have the time to read the message queue, because it is in a single thread and you might not let Windows breath. But I'm not giving a solution because it is not always easy to do give back the hand to Windows in the middle of a routine. It depends on the design of your algorithm.
-
October 2nd, 2005, 07:07 AM
#4
Re: Can't force window repaint?
 Originally Posted by rxbagain
Try to send the WM_PAINT message.
Hope it will help you
No you must not do this. Application must never sent WM_PAINT to another process, MSDN says.
I suppose the problem is that you program does not have the time to read the message queue, because it is in a single thread and you might not let Windows breath.
No, this is not problem either. I have 2 buttons in app. Click button 1, it draws rubbish on another process hwnd. Click button 2, it sends InvalidateRect/UpdateWindow etc all code I pasted to that process hwnd.
I click button 1, it draws fine. I click button 2, nothing. I exit my app, nothing. I do anything else, nothing. Window in other process is only repainted when I clcik on it & give focus or force repaint by doing something.
It is strange...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|