1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
static HDC handle_MemoryDC;
static HDC handle_ScreenDC;
//BITMAP bitmap;
static HBITMAP handle_Bitmap;
static int x, y;
case WM_CREATE:{
CreateWindowEx(NULL, "STATIC", "", SS_BITMAP|WS_VISIBLE|WS_CHILD, 500,300, 640 ,360 , hwnd, HMENU(IDCSTATIC_BITMAP), GetModuleHandle(NULL), NULL);
handle_ScreenDC = GetDC(NULL);
handle_MemoryDC = CreateCompatibleDC(handle_ScreenDC);
x = GetDeviceCaps(handle_ScreenDC, HORZRES);
y = GetDeviceCaps(handle_ScreenDC, VERTRES);
handle_Bitmap = CreateCompatibleBitmap(handle_ScreenDC, 640, 360);
SelectObject(handle_MemoryDC, handle_Bitmap);
StretchBlt(handle_MemoryDC, 0, 0, 640, 360, handle_ScreenDC, 0, 0, x, y, SRCCOPY);
SendDlgItemMessage(hwnd, IDCSTATIC_BITMAP, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)handle_Bitmap);
| |