这个我不懂啊, 求指教 - C++ Builder / Windows SDK/API
HBITMAP GetCaptureBmp() { HDC hDC; HDC MemDC; BYTE* Data; HBITMAP hBmp; BITMAPINFO bi; memset(&bi, 0, sizeof(bi)); bi.bmiHeader.biSize = sizeof(BITMAPINFO); bi.bmiHeader.biWidth = GetSystemMetrics(SM_CXSCREEN); bi.bmiHeader.biHeight = GetSystemMetrics(SM_CYSCREEN); bi.bmiHeader.biPlanes = 1; bi.bmiHeader.biBitCount = 24; hDC = GetDC(NULL); MemDC = CreateCompatibleDC(hDC); hBmp = CreateDIBSection(MemDC, &bi, DIB_RGB_COLORS, (void**)&Data, NULL, 0); SelectObject(MemDC, hBmp); BitBlt(MemDC, 0, 0, bi.bmiHeader.biWidth, bi.bmiHeader.biHeight,hDC, 0, 0, SRCCOPY); ReleaseDC(NULL, hDC); DeleteDC(MemDC); return hBmp; }
hDC = GetDC(NULL); MemDC = CreateCompatibleDC(hDC); hBmp = CreateDIBSection(MemDC, &bi, DIB_RGB_COLORS, (void**)&Data, NULL, 0); SelectObject(MemDC, hBmp); BitBlt(MemDC, 0, 0, bi.bmiHeader.biWidth, bi.bmiHeader.biHeight,hDC, 0, 0, SRCCOPY); ReleaseDC(NULL, hDC); DeleteDC(MemDC); return hBmp;