R3xy
July 19th, 2002, 03:52 PM
i'm trying to make a popup window (no borders, no title bar) that'll have a bmp drawn on all of it and a certin color in the bmp will b transperant... so far i managed to make the window using createwindowex with no probs then using gdi i drew the bmp on it, all was easy. then using a function from here (http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=541&lngWId=3) i tried making part of the window transperant. after compiling i get no errors yet what i get is a simplae popup window that has a bmp drawn all over it :(
here is the part of the code where the window creation, bmp drawing and making some of the window transperant takes place (to see the defnition of the MakeTransparent function go to url mentioned above where i said i took the function from):
// fill in the window class stucture
winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_DBLCLKS | CS_OWNDC |
CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc = WindowProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hinstance;
winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
winclass.hCursor = LoadCursor(NULL, IDC_ARROW);
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME;
winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
// register the window class
if (!RegisterClassEx(&winclass))
return(0);
// create the window
if (!(hwnd = CreateWindowEx(NULL, // extended style
WINDOW_CLASS_NAME, // class
"Wave Installer", // title
WS_POPUP | WS_VISIBLE,
100,100, // initial x,y
450,371, // initial width, height
NULL, // handle to parent
NULL, // handle to menu
hinstance,// instance of this application
NULL))) // extra creation parms
return(0);
HBITMAP hBitmap=(HBITMAP)LoadImage(hinstance,MAKEINTRESOURCE(IDB_BITMAP2),IMAGE_BITMAP,0,0,LR_DEFAULTCOLOR);
RECT rect;
GetClientRect(hwnd, &rect);
PAINTSTRUCT ps;
HDC dc=BeginPaint(hwnd, &ps);
HDC bitmap_dc=CreateCompatibleDC(dc);
HBITMAP old_bitmap=(HBITMAP)SelectObject(bitmap_dc, hBitmap);
BitBlt(dc, 0,0, rect.right,rect.bottom, bitmap_dc, 0,0, SRCCOPY);
SelectObject(bitmap_dc, old_bitmap); DeleteDC(bitmap_dc);
MakeTransparent(hwnd,219,223,255,450,371);
here is the part of the code where the window creation, bmp drawing and making some of the window transperant takes place (to see the defnition of the MakeTransparent function go to url mentioned above where i said i took the function from):
// fill in the window class stucture
winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_DBLCLKS | CS_OWNDC |
CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc = WindowProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hinstance;
winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
winclass.hCursor = LoadCursor(NULL, IDC_ARROW);
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME;
winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
// register the window class
if (!RegisterClassEx(&winclass))
return(0);
// create the window
if (!(hwnd = CreateWindowEx(NULL, // extended style
WINDOW_CLASS_NAME, // class
"Wave Installer", // title
WS_POPUP | WS_VISIBLE,
100,100, // initial x,y
450,371, // initial width, height
NULL, // handle to parent
NULL, // handle to menu
hinstance,// instance of this application
NULL))) // extra creation parms
return(0);
HBITMAP hBitmap=(HBITMAP)LoadImage(hinstance,MAKEINTRESOURCE(IDB_BITMAP2),IMAGE_BITMAP,0,0,LR_DEFAULTCOLOR);
RECT rect;
GetClientRect(hwnd, &rect);
PAINTSTRUCT ps;
HDC dc=BeginPaint(hwnd, &ps);
HDC bitmap_dc=CreateCompatibleDC(dc);
HBITMAP old_bitmap=(HBITMAP)SelectObject(bitmap_dc, hBitmap);
BitBlt(dc, 0,0, rect.right,rect.bottom, bitmap_dc, 0,0, SRCCOPY);
SelectObject(bitmap_dc, old_bitmap); DeleteDC(bitmap_dc);
MakeTransparent(hwnd,219,223,255,450,371);