HDC desktop_dc = GetDC(GetDesktopWindow());
hdcCompatible = CreateCompatibleDC(desktop_dc); BITMAPINFO binfo;
memset(&binfo,0, sizeof(binfo));
binfo.bmiHeader.biSize = sizeof(binfo);
binfo.bmiHeader.biPlanes = 1;
binfo.bmiHeader.biBitCount = 32;
binfo.bmiHeader.biCompression = BI_RGB;
binfo.bmiHeader.biHeight = height;
binfo.bmiHeader.biWidth = width;

hBitmap = CreateDIBSection(hdcCompatible, &binfo, DIB_RGB_COLORS, &frame_buffer, NULL, 0);
SelectObject(hdcCompatible, hBitmap);
bm_width = width;
bm_height = height; ::SetMapMode(hdcCompatible, MM_TEXT); return frame_buffer;特别是hdcCompatible 和 CreateDIBSection