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. .NET (Core and Framework)
  4. Screengrabbing, best way?

Screengrabbing, best way?

Scheduled Pinned Locked Moved .NET (Core and Framework)
graphicsperformancetutorialquestion
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.
  • S Offline
    S Offline
    Stevie
    wrote on last edited by
    #1

    Hi there, Screencaptureing seems to not let go of me. Right now I'm using the Method Graphics.CopyFromScreen to capture screen images (whole desktop and parts of it) and I think, that using this method is quite costly regarding CPU and memory consumption. So I'm wondering how other projects deal with this task... I don't want to reinvent VNC or something. The goal here is to grab a movie-like thing from the desktop with minimum CPU/memory consumption. Is there a best practices guide or something floating around? I need everything from algorithms to actual source code... Thank you very, very much in advance! Best regards, Stevie

    Greetings, Stephan Eberle hawke@deltacity.org

    S 1 Reply Last reply
    0
    • S Stevie

      Hi there, Screencaptureing seems to not let go of me. Right now I'm using the Method Graphics.CopyFromScreen to capture screen images (whole desktop and parts of it) and I think, that using this method is quite costly regarding CPU and memory consumption. So I'm wondering how other projects deal with this task... I don't want to reinvent VNC or something. The goal here is to grab a movie-like thing from the desktop with minimum CPU/memory consumption. Is there a best practices guide or something floating around? I need everything from algorithms to actual source code... Thank you very, very much in advance! Best regards, Stevie

      Greetings, Stephan Eberle hawke@deltacity.org

      S Offline
      S Offline
      Super Lloyd
      wrote on last edited by
      #2

      If you decompile Graphics.CopyScreen with Reflector you can see it's quite simple DeviceContext context = DeviceContext.FromHwnd(IntPtr.Zero)) SafeNativeMethods.BitBlt(...) I don't see how you can improve on that... And I believe VNC does that the 1st time then plug a Window Hook on the WM_PAINT event to repaint just what's needed... (through GDI, miss the DirectX stuff)

      A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

      S 1 Reply Last reply
      0
      • S Super Lloyd

        If you decompile Graphics.CopyScreen with Reflector you can see it's quite simple DeviceContext context = DeviceContext.FromHwnd(IntPtr.Zero)) SafeNativeMethods.BitBlt(...) I don't see how you can improve on that... And I believe VNC does that the 1st time then plug a Window Hook on the WM_PAINT event to repaint just what's needed... (through GDI, miss the DirectX stuff)

        A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

        S Offline
        S Offline
        Stevie
        wrote on last edited by
        #3

        Hi, hooking WM_PAINT sounds like a good way, but how is it done? Is every application hooked or is there some über-hook to catch all redraws appearing? Thank you, Stevie

        Greetings, Stephan Eberle hawke@deltacity.org

        S 1 Reply Last reply
        0
        • S Stevie

          Hi, hooking WM_PAINT sounds like a good way, but how is it done? Is every application hooked or is there some über-hook to catch all redraws appearing? Thank you, Stevie

          Greetings, Stephan Eberle hawke@deltacity.org

          S Offline
          S Offline
          Super Lloyd
          wrote on last edited by
          #4

          problem is.. you can't do WM_PAIN hook in C# (in fact I'm not sure you can hook WM_PAINT) but anyway, here are some links: Global Windows Hooks[^] http://msdn.microsoft.com/en-us/library/ms997537.aspx[^]

          A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

          S 1 Reply Last reply
          0
          • S Super Lloyd

            problem is.. you can't do WM_PAIN hook in C# (in fact I'm not sure you can hook WM_PAINT) but anyway, here are some links: Global Windows Hooks[^] http://msdn.microsoft.com/en-us/library/ms997537.aspx[^]

            A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

            S Offline
            S Offline
            Stevie
            wrote on last edited by
            #5

            Thank you, this looks like fun, ... not... :wtf: I'll try to implement GetMessage-hooking. Seems that's the best approach (to me)... Thank you for your help! Best regards, Stevie

            Greetings, Stephan Eberle hawke@deltacity.org

            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