bitblt

Cursor disappears on bitblt

烈酒焚心 提交于 2021-02-19 05:47:25
问题 I have a windows application that scrapes pixels from the screen for recording (in the form of a video) to a custom screen-sharing format. The problem is that on machines using a software cursor, blitting from the screen with SRCCOPY|CAPTUREBLIT (so that layered windows also show up in the image) causes the cursor to blink, as described in Case of the Disappearing Cursor. For single screen shots, this is not a problem, but when multiple screen shots are taken in rapid succession, the cursor

WinAPI/GDI: why snapshot of large windows includes taskbar?

心已入冬 提交于 2020-04-30 08:54:47
问题 I am using GDI+ to take window snapshot, the code is: CComBSTR bstrfname (fname); HDC hdc = CreateCompatibleDC (hDC); HBITMAP hbmp = CreateCompatibleBitmap (hDC, CFG_WIDTH, CFG_HEIGHT); HBITMAP hbmp0 = (HBITMAP)SelectObject (hdc, hbmp); BitBlt (hdc, 0, 0, CFG_WIDTH, CFG_HEIGHT, hDC, 0, 0, SRCCOPY); Gdiplus::Bitmap *bmp = new Gdiplus::Bitmap (hbmp, NULL); CLSID encoderClsid; GetEncoderClsid (L"image/png", &encoderClsid); bmp->Save (bstrfname, &encoderClsid, NULL); delete bmp; SelectObject (hdc

WinAPI/GDI: why snapshot of large windows includes taskbar?

老子叫甜甜 提交于 2020-04-30 08:53:00
问题 I am using GDI+ to take window snapshot, the code is: CComBSTR bstrfname (fname); HDC hdc = CreateCompatibleDC (hDC); HBITMAP hbmp = CreateCompatibleBitmap (hDC, CFG_WIDTH, CFG_HEIGHT); HBITMAP hbmp0 = (HBITMAP)SelectObject (hdc, hbmp); BitBlt (hdc, 0, 0, CFG_WIDTH, CFG_HEIGHT, hDC, 0, 0, SRCCOPY); Gdiplus::Bitmap *bmp = new Gdiplus::Bitmap (hbmp, NULL); CLSID encoderClsid; GetEncoderClsid (L"image/png", &encoderClsid); bmp->Save (bstrfname, &encoderClsid, NULL); delete bmp; SelectObject (hdc

How to correctly screencapture a specific window on Aero/DWM

倖福魔咒の 提交于 2020-01-11 20:05:50
问题 Background info: I have this MFC application I coded and been using for a long time that pretty much automatically saves screenshots to the hard disk when the user hits the Print Screen/Alt+Print Screen key. I have been putting off using anything related to Aero until now that I've been using Windows 7 RC for a couple of weeks. The problem: I'm using the standard GetDC/BitBlt method to capture the window contents. I have no problems with this method while doing regular full-screen grabs (no

How to correctly screencapture a specific window on Aero/DWM

喜你入骨 提交于 2020-01-11 20:03:32
问题 Background info: I have this MFC application I coded and been using for a long time that pretty much automatically saves screenshots to the hard disk when the user hits the Print Screen/Alt+Print Screen key. I have been putting off using anything related to Aero until now that I've been using Windows 7 RC for a couple of weeks. The problem: I'm using the standard GetDC/BitBlt method to capture the window contents. I have no problems with this method while doing regular full-screen grabs (no

C++ Screen capture fail after hundreds repetitions on Windows: memory leak?

梦想的初衷 提交于 2020-01-06 06:49:07
问题 I use a function which captures a screen using the BitBlt mehtod and can then return a HBITMAP . int screenCapture() { int width = 1000; int height = 700; HDC hdcTemp, hdc; BYTE* bitPointer; hdc = GetDC(HWND_DESKTOP); hdcTemp = CreateCompatibleDC(hdc); BITMAPINFO bitmap; bitmap.bmiHeader.biSize = sizeof(bitmap.bmiHeader); bitmap.bmiHeader.biWidth = width; bitmap.bmiHeader.biHeight = -height; bitmap.bmiHeader.biPlanes = 1; bitmap.bmiHeader.biBitCount = 24; bitmap.bmiHeader.biCompression = BI

BITMAPV5HEADER getting RGBA keep A at 255

怎甘沉沦 提交于 2020-01-06 02:37:13
问题 I am obtaining a byte array of a screenshot by the following, this is done in ctypes, there is no issues with the ctypes, if I gave this a ctypes tag the ctypes folks would be confused, so I simplified out all the error checking etc to show you the procedure. CreateDC('DISPLAY', null, null, null); nWidth = GetDeviceCaps(hdcScreen, HORZRES); // 1280 // numbers are always divisilbe by 4 nHeight = GetDeviceCaps(hdcScreen, ostypes.CONST.VERTRES); // 1024 nBPP = GetDeviceCaps(hdcScreen, BITSPIXEL)

bitblt failed on Windows 10 version 1703 (15063.138)

自闭症网瘾萝莉.ら 提交于 2020-01-04 05:45:32
问题 using Visual Studio 2017, vc141, the following code should got a screenshot from front game window but now it return a black and blank image. only issue with games(tried OpenGL and Vulkan, ogl return black, vulkan return white) before upgrade to windows 10 1703, it works on windows 10 1607 and windows 7 sp1 #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> code: BOOL ScreenShot(cv::Mat *img, HWND hWnd = NULL) { HBITMAP hBitmap; HDC

TransparentBlt、StretchBlt与BitBlt三个函数的区别

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 01:34:10
BOOL StretchBlt( int x, //指定目的矩形区域左上角的X坐标 int y, //指定目的矩形区域左上角的Y坐标 int nWidth, //指定目的矩形区域的宽度 int nHeight, //指定目的矩形区域的高度 CDC* pSrcDC, int xSrc, //指定源矩形区域左上角的X坐标 int ySrc, //指定源矩形区域左上角的Y坐标 int nSrcWidth, //指定源矩形区域的宽度 int nSrcHeight, //指定源矩形区域的高度 DWORD dwRop //此参数参考MSDN,SRCCOPY类型为直接拷贝 ); //此函数将一个位图资源从一个矩形区域拷贝到另一个矩形区域,即 缩放位图 BOOL TransparentBlt( int xDest, int yDest, int nDestWidth, int nDestHeight, CDC* pSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT clrTransparent ); //此函数 同样具有缩放功能 ,但此函数最后一个参数用来指定作为透明色的RGB; BOOL BitBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc

Is it possible to BitBlt directly from a GDI+ bitmap?

試著忘記壹切 提交于 2019-12-31 23:10:32
问题 Is it possible to use BitBlt to copy directly out of a GDI+ bitmap without using GetHBitmap? GetHBitmap is slow because it makes a new copy of the whole image, in addition to and slower than the BitBlt copy, and the given HBITMAP must be disposed. The image is large. Is there a way to point BitBlt to use the pixel data of the original GDI+ image? EDIT: I can get a pointer to where the GDI+ bitmap pixel data is in the memory. Can I create an HBITMAP that points to the GDI+ bitmap pixel data to