
- Faststone screen capture one of two monitor for screenshot full#
- Faststone screen capture one of two monitor for screenshot code#
We are thus painting it white withīitBlt function using the WHITENESS option of the API. This is because if the user selects display area spanning different screens of different resolutions, the 'hidden' area will be made black by the transfer function. One point of interest above is that we are painting the original compatible DC white before making the screen data transfer. Public static extern int ReleaseDC( int hWnd, int hDC) Public static extern int GetWindowDC( int hWnd) Public static extern int GetDesktopWindow() Public static extern int SelectObject( int hdc, int hgdiobj)

Public static extern int GetDeviceCaps( int hdc, int nIndex) Static extern int CreateDC( string lpszDriver, string lpszDevice, string lpszOutput, IntPtr lpInitData) Public static extern bool DeleteObject( int hObject) Public static extern bool DeleteDC( int hdc) Public static extern int CreateCompatibleDC( int hdc) Public static extern int CreateCompatibleBitmap( int hdc, int nWidth, int nHeight) Int nWidth, int nHeight, int hdcSrc, int nXSrc, int nYSrc, int dwRop) Public static extern bool BitBlt( int hdcDest, int nXDest, int nYDest, Various APIs above are called from GDI32/USER32.dll as they are not provided by. Image imf = Image.FromHbitmap( new IntPtr(hBitmap)) Main API that does memory data transferīitBlt(hdcDest, X-x, Y-y, X1-X, Y1-Y, hdcSrc, X, Y,Ġx40000000 | 0x00CC0020) // SRCCOPY AND CAPTUREBLT Now copy the areas from each screen on the destination hbitmapįor ( int i = 0 i (x + wid) || ( + use whiteness flag to make destination screen whiteīitBlt(hdcDest, 0, 0, wid, hei, ( int)hdc, 0, 0, 0x00FF0062) set the destination area White - a little complicated Int hBitmap = CreateCompatibleBitmap(hdcSrc, wid, hei) Int hdcDest = CreateCompatibleDC(hdcSrc) create DC for the entire virtual screen int hdcSrc = CreateDC( " DISPLAY", null, null, IntPtr.Zero)
Faststone screen capture one of two monitor for screenshot code#
The main method takes input the left-top XY coordinates and the width/height of the user selected area.Ĭopy Code // function to capture screen section public static void CaptureScreentoClipboard( int x, int y, int wid, int hei)

Faststone screen capture one of two monitor for screenshot full#
Screen_Capture is the main class that provide functionality to capture the Full display of the windows and save it to clipboard. This bitmap can then be saved into clipboard or a file.

This Device context is used to read the entire display data into a bitmap. Windows provide a Device Context to its (total) display system. If (maxheight < ( + )) maxheight = + Ĭapture_class.CaptureScreentoClipboard( 0, 0, maxwidth, maxheight) Int noofscreens = screens.Length, maxwidth = 0, maxheight = 0
