Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 47279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:05:51+00:00 2026-05-10T16:05:51+00:00

Is there a one button way to save a screenshot directly to a file

  • 0

Is there a one button way to save a screenshot directly to a file in Windows?

TheSoftwareJedi accurately answered above question for Windows 8 and 10. Below original extra material remains for posterity.

This is a very important question as the 316K views shows as of 2021. Asked in 2008, SO closed this question around 2015 as being off-topic, probably because of the last question below.

In Windows XP, one can press Alt-PrintScreen to copy an image of the active window, or Ctrl-PrintScreen to copy an image of the full desktop.

This can then be pasted into applications that accept images: Photoshop, Microsoft Word, etc.

I’m wondering: Is there a way to save the screenshot directly to a file? Do I really have to open an image program, like Paint.net or Photoshop, simply to paste an image, then save it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:05:52+00:00Added an answer on May 10, 2026 at 4:05 pm

    You can code something pretty simple that will hook the PrintScreen and save the capture in a file.

    Here is something to start to capture and save to a file. You will just need to hook the key ‘Print screen’.

    using System; using System.Drawing; using System.IO; using System.Drawing.Imaging; using System.Runtime.InteropServices; public class CaptureScreen {      static public void Main(string[] args)     {          try         {             Bitmap capture = CaptureScreen.GetDesktopImage();             string file = Path.Combine(Environment.CurrentDirectory, 'screen.gif');             ImageFormat format = ImageFormat.Gif;             capture.Save(file, format);         }         catch (Exception e)         {             Console.WriteLine(e);         }      }      public static Bitmap GetDesktopImage()     {         WIN32_API.SIZE size;          IntPtr  hDC = WIN32_API.GetDC(WIN32_API.GetDesktopWindow());          IntPtr hMemDC = WIN32_API.CreateCompatibleDC(hDC);          size.cx = WIN32_API.GetSystemMetrics(WIN32_API.SM_CXSCREEN);         size.cy = WIN32_API.GetSystemMetrics(WIN32_API.SM_CYSCREEN);          m_HBitmap = WIN32_API.CreateCompatibleBitmap(hDC, size.cx, size.cy);          if (m_HBitmap!=IntPtr.Zero)         {             IntPtr hOld = (IntPtr) WIN32_API.SelectObject(hMemDC, m_HBitmap);             WIN32_API.BitBlt(hMemDC, 0, 0,size.cx,size.cy, hDC, 0, 0, WIN32_API.SRCCOPY);             WIN32_API.SelectObject(hMemDC, hOld);             WIN32_API.DeleteDC(hMemDC);             WIN32_API.ReleaseDC(WIN32_API.GetDesktopWindow(), hDC);             return System.Drawing.Image.FromHbitmap(m_HBitmap);          }         return null;     }      protected static IntPtr m_HBitmap; }  public class WIN32_API {     public struct SIZE     {         public int cx;         public int cy;     }     public  const int SRCCOPY = 13369376;     public  const int SM_CXSCREEN=0;     public  const int SM_CYSCREEN=1;      [DllImport('gdi32.dll',EntryPoint='DeleteDC')]     public static extern IntPtr DeleteDC(IntPtr hDc);      [DllImport('gdi32.dll',EntryPoint='DeleteObject')]     public static extern IntPtr DeleteObject(IntPtr hDc);      [DllImport('gdi32.dll',EntryPoint='BitBlt')]     public static extern bool BitBlt(IntPtr hdcDest,int xDest,int yDest,int wDest,int hDest,IntPtr hdcSource,int xSrc,int ySrc,int RasterOp);      [DllImport ('gdi32.dll',EntryPoint='CreateCompatibleBitmap')]     public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc,  int nWidth, int nHeight);      [DllImport ('gdi32.dll',EntryPoint='CreateCompatibleDC')]     public static extern IntPtr CreateCompatibleDC(IntPtr hdc);      [DllImport ('gdi32.dll',EntryPoint='SelectObject')]     public static extern IntPtr SelectObject(IntPtr hdc,IntPtr bmp);      [DllImport('user32.dll', EntryPoint='GetDesktopWindow')]     public static extern IntPtr GetDesktopWindow();      [DllImport('user32.dll',EntryPoint='GetDC')]     public static extern IntPtr GetDC(IntPtr ptr);      [DllImport('user32.dll',EntryPoint='GetSystemMetrics')]     public static extern int GetSystemMetrics(int abc);      [DllImport('user32.dll',EntryPoint='GetWindowDC')]     public static extern IntPtr GetWindowDC(Int32 ptr);      [DllImport('user32.dll',EntryPoint='ReleaseDC')]     public static extern IntPtr ReleaseDC(IntPtr hWnd,IntPtr hDc); } 

    Update Here is the code to hook the PrintScreen (and other key) from C#:

    Hook code

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 65k
  • Answers 65k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer That depends if you want to do exact match or… May 11, 2026 at 11:09 am
  • added an answer Assuming you have an Email object with a @OneToOne or… May 11, 2026 at 11:09 am
  • added an answer Would a Bloom filter help? If the bit vector is… May 11, 2026 at 11:09 am

Related Questions

Is there a one button way to save a screenshot directly to a file
Is there a way to specify a one dimensional array in a ini file.
Is there a .NET equivalent of Java Web Start? I want a one-click, from
Is there a quick one-liner to call datepart in Sql Server and get back
Is there a quick tcpdump one-liner to print out a TCP stream that matches
Is there a tool that allows one to monitor GDI calls?
Is there a benefit to using one over the other? In Python 2, they
Is there a difference or is one better than the other of the following:
Is there a way of reading one single character from the user input? For
Is there a way to select data where any one of multiple conditions occur

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.