Code:
HBITMAP Ball = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BALL));
HBITMAP BallMask = CreateBitmapMask(Ball, RGB(255,0,255));
Code:
HBITMAP CreateBitmapMask(COLORREF hbmColour, COLORREF crTransparent);
HBITMAP CreateBitmapMask(HBITMAP hbmColour, COLORREF crTransparent)
{
HDC hdcMem, hdcMem2;
HBITMAP hbmMask;
BITMAP bm;
GetObject(hbmColour, sizeof(BITMAP), &bm); //bm holds ship info now
hbmMask = CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, NULL); //create a bitmap with same size
hdcMem = CreateCompatibleDC(0); //two new DCs
hdcMem2 = CreateCompatibleDC(0);
SelectObject(hdcMem, hbmColour); //ship into MemDC
SelectObject(hdcMem2, hbmMask); //blank bitmap, same size, into MemDC #2
SetBkColor(hdcMem, crTransparent); //background of DC with ship is pink
BitBlt(hdcMem2, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
//ship with pink background blitted onto blank bitmap
BitBlt(hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem2, 0, 0, SRCINVERT);
//hDCMem2 has small bitmap w/ pink background
DeleteDC(hdcMem);
DeleteDC(hdcMem2);
return hbmMask;
}
c:\documents and settings\administrator\desktop\leegames\pong\main. cpp(36) : error C2664: 'CreateBitmapMask' : cannot convert parameter 1 from 'struct HBITMAP__ *' to 'unsigned long'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
i get that error when trying to make the bitmap mask
anyone know why?