Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Flicker draw nightmare

Flicker draw nightmare

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsperformancehelpquestion
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Axonn Echysttas
    wrote on last edited by
    #1

    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

    Richard Andrew x64R RaviBeeR 2 Replies Last reply
    0
    • A Axonn Echysttas

      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

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • A Axonn Echysttas

        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

        RaviBeeR Offline
        RaviBeeR Offline
        RaviBee
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups