I am running the following function, and the bolded line is having this error:
"ANSI C++ forbids implicit conversion from `void *' in assignment"
Here is the function:
Code:
void Board::RefreshBoard(Piece* currentPiece, HDC BoardHDC)
{
bool check;
HBITMAP hbmCurrentSq,hbmOld;
HWND hwnd;
HINSTANCE hInst = GetModuleHandle(NULL);
hbmSquare[0] = LoadBitmap(hInst, "WHITEBMP");
hbmSquare[1] = LoadBitmap(hInst, "GREENBMP");
hbmSquare[2] = LoadBitmap(hInst, "YELLOWBMP");
hbmSquare[3] = LoadBitmap(hInst, "REDBMP");
hbmSquare[4] = LoadBitmap(hInst, "PURPLEBMP");
hbmSquare[5] = LoadBitmap(hInst, "BLUEBMP");
hbmSquare[6] = LoadBitmap(hInst, "ORANGEBMP");
if(!hbmSquare[0] || !hbmSquare[1] || !hbmSquare[2] || !hbmSquare[3] || !hbmSquare[4] || !hbmSquare[5] || !hbmSquare[6])
MessageBox(hwnd, "You hit a c!", "C baby", MB_OK | MB_ICONEXCLAMATION);
for(int y=0; y<20; y++)
{
for(int x=0; x<10; x++)
{
if(theBoard[x][y] > 0)
{
HDC hdcMemory2;
hdcMemory2 = CreateCompatibleDC(BoardHDC);
hbmCurrentSq = hbmSquare[theBoard[x][y]-1];
hbmOld = SelectObject(hdcMemory2, hbmCurrentSq);
check = BitBlt(BoardHDC, x*17, y*17, 17, 17, hdcMemory2, 0, 0, SRCCOPY);
SelectObject(hdcMemory2, hbmOld);
DeleteDC(hdcMemory2);
}
else if(theBoard[x][y] == 0)
currentPiece->RemoveOneSquare(x,y);
}
}
}
Basically I'm guessing this is returning a NULL because the SelectObject line is failing, but I don't know why it is failing. Someone tell me whats wrong! The reason I'm doing is is to try to free the default HBITMAP (from the last time it ran) that is returned everytime SelectObject runs.
Please help!