From: Jimbo on 15 May 2010 08:25 Hello I need to find out if there are any messages sent to a child window when its parent window is minimised. I need to do this because I have a custom control I have made, but when its parent window is minimised then restored, not all of my control is completely drawn again. This is because I only allow certain parts of the control to be drawn in WM_PAINT(& WM_PAINT is called when the minimised parent window is restored). So if I can figure out when the parent window is minimised, I can then set a bool variable redrawCompletely = true; so when the parent window is restored & the WM_PAINT message is sent I can make sure the whole control is redrawn. Hope that makes sense. The only other way I can fix my problem is to make my WM_PAINT redraw the whole control everytime WM_PAINT is called but that seems really inefficient. Why cant WM_PAINT have an LPARAM value that says "I am repainting because x" where x is ('drawing window for 1st time', 'redrawing because window was resized', etc) :P That would make using WM_PAINT sooo much easier. Example of how I'd like to solve this prob: LRESULT CALLBACK WNDPROC(....) { switch (msg) { case "parent window was minimised": redrawCompletly = true; break; case WM_PAINT: HDC ... if (redrawCompletely) drawCompleteControl(hdc); if (drawOneCell) drawCell(hdc); EndPaint(..); break; } }
From: winapi on 15 May 2010 08:50 > I need to find out if there are any messages sent to a child window > when its parent window is minimised. > > I need to do this because I have a custom control I have made, but > when its parent window is minimised then restored, not all of my > control is completely drawn again. > > This is because I only allow certain parts of the control to be drawn > in WM_PAINT(& WM_PAINT is called when the minimised parent window is > restored). So if I can figure out when the parent window is minimised, > I can then set a bool variable redrawCompletely = true; so when the > parent window is restored & the WM_PAINT message is sent I can make > sure the whole control is redrawn. > > Hope that makes sense. > > The only other way I can fix my problem is to make my WM_PAINT redraw > the whole control everytime WM_PAINT is called but that seems really > inefficient. Why cant WM_PAINT have an LPARAM value that says "I am > repainting because x" where x is ('drawing window for 1st time', > 'redrawing because window was resized', etc) :P That would make using > WM_PAINT sooo much easier. > You should be able to this with. . . . SetFocus() & GetFocus().
From: Matti Vuori on 15 May 2010 08:57 Jimbo <nilly16(a)yahoo.com> wrote in news:b4eb953d-113a-4c76-b3a1- e0f70ca50822(a)34g2000prs.googlegroups.com: > I need to find out if there are any messages sent to a child window > when its parent window is minimised. I don't know, probably not, but of course you can check the status of the parent in the beginning of your control's WM_PAINT handler.
From: ScottMcP [MVP] on 15 May 2010 09:53 > Jimbo <nill...(a)yahoo.com> wrote in news:b4eb953d-113a-4c76-b3a1- > e0f70ca50...(a)34g2000prs.googlegroups.com: > > > I need to find out if there are any messages sent to a child window > > when its parent window is minimised. The parent being minimized/restored is not the only case where you need to repaint the entire control. For example, another program's window could cover/uncover your control. Windows does not provide you with the reason you need to repaint. But it does provide information on how much you need to repaint. The only way to reduce the amount of painting you do is to check the rcPaint area that you get when you call BeginPaint, and don't bother to paint anything that is outside of that rectangle.
|
Pages: 1 Prev: Message sent when window is Minimised Next: ANN: Seed7 Release 2010-05-16 |