禁用Aero时,BitBlt无法复制窗口数据

时间:2018-08-11 17:34:10

标签: c# bitmap screenshot bitblt

当我尝试使用台式机的快照店时,如果使用DwmEnableComposition禁用了Windows Aero,它将无法从记事本++获取图像数据。

以下是问题的一个示例:

http://i.imgur.com/fzU9pXp.gifv

IntPtr hDC = CreateCompatibleDC(IntPtr.Zero);


//IntPtr hWnd = GetDesktopWindow();
IntPtr hWnd = IntPtr.Zero;

IntPtr hdcTarget = GetDC(hWnd);

IntPtr hBitmap = CreateDIBSection(hDC, ref bi, DIB_RGB_COLORS, out pBits, IntPtr.Zero, 0);

hBitmapOld = SelectObject(hDC, hBitmap);


BitBlt(hDC, 0, 0, width, height, hdcTarget, 0, 0, (System.Int32)(TernaryRasterOperations.SRCCOPY | TernaryRasterOperations.BLT));

录制Visual Studio 2015的窗口时也有类似的问题。 禁用Windows Aero时如何使用BitBlt获取所有图像数据?

0 个答案:

没有答案