Flicker draw nightmare
-
Hey everybody. I'm so pissed off and angry on this thing I'm working on, that I exhausted myself. Before angrily going to sleep, I'm going to tell you a bit of this problem, maybe there are some bright minds out there which can figure out what I couldn't, all day. I got a main window. One "Static" window in it (a label child) with some text. Even though the main window is HWND_TOPMOST, sometimes Window's OS tooltips get over it. In those cases, I need to repaint. So I invalidate and repaint. The problem is that the child flickers. If I do 10 repaits per second I see an annoying flicker. I've been killing myself all day with back-drawing in memory DCs but with no use grr. Whatever I do, that label keeps flickering! What can I do about it!? ANY IDEAS? ANY? ANY LITTLE THING. I'm desperate ::- (. I was thinking 5 minutes ago to make a snapshot of the window in a HBITMAP and then simply BitBlt that each redraw. But probably the label will keep flickering since probably it's WM_PAINT code will execute before or after the main's window WM_PAINT (don't know the order of events right now) so I'm going to have worked in vain to construct that snapshots system. -= E C H Y S T T A S =- The Greater Mind Balance
-
Hey everybody. I'm so pissed off and angry on this thing I'm working on, that I exhausted myself. Before angrily going to sleep, I'm going to tell you a bit of this problem, maybe there are some bright minds out there which can figure out what I couldn't, all day. I got a main window. One "Static" window in it (a label child) with some text. Even though the main window is HWND_TOPMOST, sometimes Window's OS tooltips get over it. In those cases, I need to repaint. So I invalidate and repaint. The problem is that the child flickers. If I do 10 repaits per second I see an annoying flicker. I've been killing myself all day with back-drawing in memory DCs but with no use grr. Whatever I do, that label keeps flickering! What can I do about it!? ANY IDEAS? ANY? ANY LITTLE THING. I'm desperate ::- (. I was thinking 5 minutes ago to make a snapshot of the window in a HBITMAP and then simply BitBlt that each redraw. But probably the label will keep flickering since probably it's WM_PAINT code will execute before or after the main's window WM_PAINT (don't know the order of events right now) so I'm going to have worked in vain to construct that snapshots system. -= E C H Y S T T A S =- The Greater Mind Balance
Well, since you're inviting any ideas, I thought I would ask why you can't draw the text directly onto the client surface of the window without using a static?
-
Hey everybody. I'm so pissed off and angry on this thing I'm working on, that I exhausted myself. Before angrily going to sleep, I'm going to tell you a bit of this problem, maybe there are some bright minds out there which can figure out what I couldn't, all day. I got a main window. One "Static" window in it (a label child) with some text. Even though the main window is HWND_TOPMOST, sometimes Window's OS tooltips get over it. In those cases, I need to repaint. So I invalidate and repaint. The problem is that the child flickers. If I do 10 repaits per second I see an annoying flicker. I've been killing myself all day with back-drawing in memory DCs but with no use grr. Whatever I do, that label keeps flickering! What can I do about it!? ANY IDEAS? ANY? ANY LITTLE THING. I'm desperate ::- (. I was thinking 5 minutes ago to make a snapshot of the window in a HBITMAP and then simply BitBlt that each redraw. But probably the label will keep flickering since probably it's WM_PAINT code will execute before or after the main's window WM_PAINT (don't know the order of events right now) so I'm going to have worked in vain to construct that snapshots system. -= E C H Y S T T A S =- The Greater Mind Balance
Axonn Echysttas wrote:
If I do 10 repaits per second I see an annoying flicker.
This is a common problem, especially in applications that need to constantly update a status string. A workaround is to use a "smart"
SetText()
method, as in:void SmartSetText
(CWnd* pWnd,
CString strText)
{
ASSERT (pWnd != NULL);
ASSERT (pWnd->GetSafeHwnd() != NULL);
CString strOldText;
pWnd->GetWindowText (strOldText);
if (strOldText.Compare (strText) != 0)
pWnd->SetWindowText (strText);}
It's a simple solution that works quite well. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com