How can I get a screenshot of the current screen using Win32?
// screen HDC HSCCDDC = DC ("display", tap, null, tap) Get device reference; // and an HDC HMMERDC = a device reference to keep in Compass DDC (HSCDDCC); Int width = GetDeviceCaps (HSCDDC, HORGES); Int height = GetDeviceCaps (HSCDDC, VERRES); // Maybe they may have to check positive values HBITMAP hBitmap = CreateCompatibleBitmap (HSCCDDC, width, height); // Get a new bitmap HBITMAP hOldBitmap = SelectObject (hMemoryDC, hBitmap); Bitblatt (HM, Mordi, 0, 0, width, height, HSCDC, 0, 0, SRCCOPI); HBitmap = SelectObject (HMRDC, HeldBitmap); // Remove DDC (HMMoradiC); DeleteDC (hScreenDC); // Your image is now organized in hBitmap. You can save it or whatever you can with it
Comments
Post a Comment