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
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
static HBITMAP bmpSource = NULL;
static HDC hdcSource = NULL;
PAINTSTRUCT ps;
HDC hdcDestination;
if (Msg == WM_CREATE)
{
bmpSource = (HBITMAP)LoadImage(NULL, L"c:\\filename.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
hdcSource = CreateCompatibleDC(GetDC(0));
SelectObject(hdcSource, bmpSource);
return 0;
}
else if (Msg == WM_PAINT)
{
hdcDestination = BeginPaint(hWnd, &ps);
BitBlt(hdcDestination, 0, 0, 500, 500, hdcSource, 0, 0, SRCCOPY);
EndPaint(hWnd, &ps);
return 0;
}
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
|