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
|
HBITMAP bmp;
HDC hdc, image_dc;
HBITMAP old_hbitmap;
POINT ptSrc = {10, 10 };
SIZE sz = { 100, 100 };
COLORREF colour = RGB(255,555,255);
case WM_CREATE:
{
bmp = (HBITMAP) LoadImage (NULL,"C:\\newbg.BMP", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if(!bmp)
MessageBoxA(NULL, (LPCSTR)GetLastError(), NULL,MB_OK|MB_ICONERROR);
hdc = GetDC(hwnd);
image_dc = CreateCompatibleDC(hdc);
old_hbitmap = (HBITMAP)SelectObject(image_dc,bmp);
BLENDFUNCTION blend;
blend.BlendOp = AC_SRC_OVER;
blend.BlendFlags = 0;
blend.SourceConstantAlpha = 255;
blend.AlphaFormat = AC_SRC_ALPHA;
BOOL bRet= UpdateLayeredWindow(hwnd, NULL, NULL, &sz, image_dc, &ptSrc, colour, &blend, ULW_COLORKEY);
}
|