Thread: cannot convert from HBITMAP__* to unsigned long

  1. #1
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001

    cannot convert from HBITMAP__* to unsigned long

    HBITMAP Ball = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BALL));
    			HBITMAP BallMask = CreateBitmapMask(Ball, RGB(255,0,255));
    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
    	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?

  2. #2
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001

    After reading my own post I saw the answer!

    excuse me for such a stupid post.....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  2. Unsigned long long to something longer
    By JFonseka in forum C Programming
    Replies: 18
    Last Post: 05-26-2008, 07:34 AM
  3. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  4. Please STICKY this- vital to MSVC 6 dev - BASETSD.h
    By VirtualAce in forum Game Programming
    Replies: 11
    Last Post: 03-15-2005, 09:22 AM