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 28
|
#include <iostream>
#include <windows.h>
using namespace std;
int show_bmp(char bmp[], int x_bmp, int y_bmp, int width_bmp, int height_bmp)
{
HBITMAP hbmObraz;
hbmObraz = (HBITMAP)LoadImage(NULL, bmp, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
hdcOkno = GetDC(hwnd);
HDC hdcNowy = CreateCompatibleDC(hdcOkno);
SelectObject(hdcNowy, hbmObraz);
BITMAP bmInfo;
GetObject(hbmObraz, sizeof(bmInfo), &bmInfo);
BitBlt(hdcOkno, x_bmp, y_bmp, width_bmp, height_bmp, hdcNowy, 0, 0, SRCCOPY);
DeleteObject(hbmObraz);
DeleteDC(hdcNowy);
DeleteDC(hdcOkno);
}
int main()
{
show_bmp("test.BMP", 0, 0, 0, 0);
system("PAUSE");
return 0;
}
|