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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help with using InvalidateRect API function to update only part of the screen

Help with using InvalidateRect API function to update only part of the screen

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsjsonhelptutorialquestion
2 Posts 2 Posters 0 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.
  • J Offline
    J Offline
    JavaTony
    wrote on last edited by
    #1

    Hi, I am doing an entire screen capture INCLUDING THE MOUSE CURSOR. For GDI function calls, the mouse cursor is automatically hidden. Therefore, I have to get a handle of the current mouse cursor and use DrawIcon to draw it onto the screen. After the screen capture, I have to invalidate the area where the mouse cursor is drawn so the drawn mouse cursor won't stay on the screen. I am using InvalidateRect(NULL, NULL, TRUE) to redraw all the windows, but this results in a very serious screen flickering while capturing the screen. I cannot figure out how to invalidate only the area where the mouse cursor is drawn. Could you give me some pointers, tips, or samples how to achieve this with InvalidateRect function? Thank you very much for your help.

    T 1 Reply Last reply
    0
    • J JavaTony

      Hi, I am doing an entire screen capture INCLUDING THE MOUSE CURSOR. For GDI function calls, the mouse cursor is automatically hidden. Therefore, I have to get a handle of the current mouse cursor and use DrawIcon to draw it onto the screen. After the screen capture, I have to invalidate the area where the mouse cursor is drawn so the drawn mouse cursor won't stay on the screen. I am using InvalidateRect(NULL, NULL, TRUE) to redraw all the windows, but this results in a very serious screen flickering while capturing the screen. I cannot figure out how to invalidate only the area where the mouse cursor is drawn. Could you give me some pointers, tips, or samples how to achieve this with InvalidateRect function? Thank you very much for your help.

      T Offline
      T Offline
      Tim Deveaux
      wrote on last edited by
      #2

      Well, that call to InvalidateRect will invalidate all windows causing WM_PAINT messages to be sent to all of them, since the HWND is NULL. And the TRUE for the bErase means that when each WM_PAINT handler calls BeginPaint (directly or by constructing a CPaintDC) the WM_ERASEBKGND message will be sent as well, causing much flicker. It sounds like you know where to draw the icon, so I would suggest that you have all the info you need to fill in these values - which window, a RECT corresponding to the icon location, and, depending on the nature of the window, perhaps FALSE for bErase, and things will be much smoother.

      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