int width = GetSystemMetrics(SM_CXSCREEN); int height = GetSystemMetrics(SM_CYSCREEN);
HBITMAP hBitmap = CreateCompatibleBitmap(hdcScreen, width, height); SelectObject(hdcMem, hBitmap); BitBlt(hdcMem, 0, 0, width, height, hdcScreen, 0, 0, SRCCOPY); copy screenshot to clipboard windows
| Shortcut | Scope | Data Format | Introduced | |----------|-------|-------------|-------------| | | Full screen | Bitmap (CF_BITMAP) | Windows 1.0 | | Alt + PrtScn | Active window only | Bitmap (CF_BITMAP) | Windows 95 | | Win + Shift + S | Selected region | PNG + Bitmap | Windows 10 (1809) | 2.1 Legacy Shortcuts (PrtScn and Alt+PrtScn) When the user presses PrtScn , Windows captures the entire virtual screen (all monitors) and stores it as a device-independent bitmap (DIB) in the clipboard under the CF_BITMAP format. The shortcut Alt+PrtScn captures only the currently active foreground window, excluding the title bar’s shadow if present. These shortcuts do not provide visual feedback or editing capabilities. 2.2 Modern Shortcut (Win+Shift+S) Introduced with the Snipping Tool & Snip & Sketch overhaul, Win+Shift+S launches the modern snipping bar, allowing rectangular, freeform, window, or full-screen snips. Upon selection, the captured image is written to the clipboard in both uncompressed bitmap and PNG formats. A system toast notification confirms the action, and the user can optionally annotate before copying. 3. Clipboard Data Formats for Images The Windows clipboard supports multiple image formats simultaneously. When a screenshot is copied, applications can retrieve the most suitable format. Win+Shift+S launches the modern snipping bar