How to capture a portion of screen?

11,700

Solution 1

Capture it with alt+PrnScr (so it gets only the active window) and then crop it in a program of your choice.

Solution 2

The snipping tool is a utility provided by default in Windows 7 and above. It does what you requested.

Solution 3

You can write a program that gets a handle to the screen's device context (GetDC), does a BitBlt from that device context to a temporary one you created with CreateCompatibleDC and populated with CreateCompatibleBitmap. Then you select your memory bitmap out and save it. Make sure to release and destroy these GDI resources.

Do do this when the user hits a certain key, your program should call RegisterHotKey and then wait for the notification.

Search MSDN for these function names for more details.

Share:
11,700

Related videos on Youtube

Fareed Ud Din
Author by

Fareed Ud Din

Updated on September 17, 2022

Comments

  • Fareed Ud Din
    Fareed Ud Din over 1 year

    I just want to know how to capture a portion of the screen. Getting the screen shot of a particular location and size in Windows.

    I want to do this using some Windows key functionality. I am not doing using and code, I am not looking for any tool. I just want to know either this is possible in Windows or not.

    • Traveling Tech Guy
      Traveling Tech Guy about 14 years
      Do you want to do it programatically? From which language/environment? What sort of screen capture? There are many possible duplicates (like stackoverflow.com/questions/1043880/… for .Net)
    • Fareed Ud Din
      Fareed Ud Din about 14 years
      FYI :if it was in any language i would have tagged it Still i have clarified it in my edited version of question
    • Fareed Ud Din
      Fareed Ud Din about 14 years
      some thing like select a part of screen using mouse and capture only that portion
    • Admin
      Admin about 14 years
      This is not a programming related question, which will most likely be closed soon, but Windows Vista and Windows 7 has a program called "Snipping Tool" that can do that.
    • Admin
      Admin about 14 years
      You might also want to ask this on superuser instead of stackoverflow.