Page 1 of 1

Tell an external program to redraw?

Posted: Fri Nov 30, 2007 6:41 am
by Seymour Clufley
Is there an API command for this?

I'm making a CDECL DLL that attaches child windows to a parent app, and it needs to tell the child windows to redraw whenever the parent app is restored.

Posted: Fri Nov 30, 2007 6:50 pm
by netmaestro
RedrawWindow_(hwnd, #Null, #Null, #RDW_UPDATENOW)

RDW_UPDATENOW Causes the affected windows (as specified by the RDW_ALLCHILDREN and RDW_NOCHILDREN flags) to receive WM_NCPAINT, WM_ERASEBKGND, and WM_PAINT messages, if necessary, before the function returns.

The two Nulls are for RECT and RGN, both of which I assume you want to ignore, resulting in the entire childwindow being redrawn.

However, if they're truly proper child windows, this should be happening automatically.

Posted: Sat Dec 01, 2007 9:15 pm
by Seymour Clufley
Sorry, I forgot to state that none of the windows are created by PB. All PB does is attach the child windows to the parent window and, if necessary, handle messages going between the windows.

Posted: Sat Dec 01, 2007 9:18 pm
by netmaestro
If a window doesn't belong to your thread you can't read its message queue. You can send a message to it and it will in all likelihood respond, but there's no communication back to your program.

Posted: Sat Dec 01, 2007 9:50 pm
by AND51
I'm not sure, but isn't it enough to send a #WM_REPAINT to the external program?
If so, you can achieve this easyly by using UpdateWindow_(handle).