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. How I can do it !!!

How I can do it !!!

Scheduled Pinned Locked Moved C / C++ / MFC
comhelp
5 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.
  • A Offline
    A Offline
    Ahmad
    wrote on last edited by
    #1

    HI ALL I want to draw circle on the screen(or desktop), I mean out of client window so I do like below : HDC hdc = CreateDC (TEXT ("DISPLAY"), NULL, NULL, NULL) ; it works but.................. then I do like below : InvalidateRect (NULL, &rc, TRUE) ; it erase the circle but.... When I use timer to draw circle and erase it quickly SetTimer (hwnd, ID_TIMER, 200, NULL) ; now the problem is apear when I erase the screen very quickly and repeatedly it makes the screen very shake ... How I can avoid this shake... THANK YOU AHMAD AL-WASHALI YEMEN washali@yahoo.com AHMAD ALWASHALI

    L 1 Reply Last reply
    0
    • A Ahmad

      HI ALL I want to draw circle on the screen(or desktop), I mean out of client window so I do like below : HDC hdc = CreateDC (TEXT ("DISPLAY"), NULL, NULL, NULL) ; it works but.................. then I do like below : InvalidateRect (NULL, &rc, TRUE) ; it erase the circle but.... When I use timer to draw circle and erase it quickly SetTimer (hwnd, ID_TIMER, 200, NULL) ; now the problem is apear when I erase the screen very quickly and repeatedly it makes the screen very shake ... How I can avoid this shake... THANK YOU AHMAD AL-WASHALI YEMEN washali@yahoo.com AHMAD ALWASHALI

      L Offline
      L Offline
      l a u r e n
      wrote on last edited by
      #2

      the 'shaking' is the natural flickering caused by erasing the bg and redrawing ... in games and other graphics programming a technique called 'double-buffering' is used essentially you grab 2 lumps of memory big enough for a copy of the screen each and draw to these ... when you are ready to show a newly updated image you blit that to the screen and avoid the erase step now if you are doing this for the whole desktop i think you may have a problem as the rest of the image will be changing beyond your control so it will be almost impossible to know what has moved where hmmmmm..... maybe you could use a borderless window that is transparent and set to the lowest z order and draw to that ... it would give the same effect but you wouldn't have to worry about other images in your client area and then could use the double buffering technique above :cool: --- "every year we invent better idiot proof systems and every year they invent better idiots"

      A 1 Reply Last reply
      0
      • L l a u r e n

        the 'shaking' is the natural flickering caused by erasing the bg and redrawing ... in games and other graphics programming a technique called 'double-buffering' is used essentially you grab 2 lumps of memory big enough for a copy of the screen each and draw to these ... when you are ready to show a newly updated image you blit that to the screen and avoid the erase step now if you are doing this for the whole desktop i think you may have a problem as the rest of the image will be changing beyond your control so it will be almost impossible to know what has moved where hmmmmm..... maybe you could use a borderless window that is transparent and set to the lowest z order and draw to that ... it would give the same effect but you wouldn't have to worry about other images in your client area and then could use the double buffering technique above :cool: --- "every year we invent better idiot proof systems and every year they invent better idiots"

        A Offline
        A Offline
        Ahmad
        wrote on last edited by
        #3

        Thank you lauren .:) but can I erase the area which I draw in ,I mean not whole screen just the area which I draw in ... AHMAD ALWASHALI

        L 1 Reply Last reply
        0
        • A Ahmad

          Thank you lauren .:) but can I erase the area which I draw in ,I mean not whole screen just the area which I draw in ... AHMAD ALWASHALI

          L Offline
          L Offline
          l a u r e n
          wrote on last edited by
          #4

          you don't draw directly to the desktop window at all you set up a window that has no border or title bar etc and that is transparent and draw to that ... it will look like it is being drawn to the desktop but in fact wont be hence you can do what you like to the window you own even if you have to copy the desktop to the window bg each time it will be far less data to copy than the whole desktop :suss: --- "every year we invent better idiot proof systems and every year they invent better idiots"

          A 1 Reply Last reply
          0
          • L l a u r e n

            you don't draw directly to the desktop window at all you set up a window that has no border or title bar etc and that is transparent and draw to that ... it will look like it is being drawn to the desktop but in fact wont be hence you can do what you like to the window you own even if you have to copy the desktop to the window bg each time it will be far less data to copy than the whole desktop :suss: --- "every year we invent better idiot proof systems and every year they invent better idiots"

            A Offline
            A Offline
            Ahmad
            wrote on last edited by
            #5

            THANK YOU VERY MUCH AHMAD ALWASHALI

            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