peternkelly
Programmer
I am trying to recompile a C++ application that I originally wrote about 12 years ago. It compiled then with a V.1 C++ compiler and has since run on Windows 98, 2000, XP and Vista machines. But it will not run on my new Windows 7 machine; hence the need to recompile, which I am trying to do with a Windows 7 C++ compiler which I have recently purchased. The particular sticking point comes in the following function:
The actual error message I get is:
Conversion from 'void*' to pointer to non- 'void' requires an explicit cast
which occurs at the point I have indicated in the source code. I have tried many variants on the above code, but the error remains. Can anyone tell me what I am doing wrong ?
peternkelly
Code:
int outmap(HBITMAP hbmOut, HWND hWnd, int xx, int yy)
/* output bitmap at xx, yy */
{
HDC hDC, hdcMemory; // display context variable
HBITMAP hbmOld;
BITMAP bm;
GetObject(hbmOut, sizeof(bm), (LPSTR)&bm);
/*
Get a DC to our window. Create a compatible memory
DC and select our image bitmap into it so we can blit
it to the main window DC
*/
hDC = GetDC(hWnd);
hdcMemory = CreateCompatibleDC(hDC);
hdmOld = SelectObject(hdcMemory, hbmOut);
// error C2440 occurs for the previous line
if(hbmOld)
{
/* Blit the image in the new position */
BitBlt( hDC, // dest DC
xx, yy, // dest origin
bm.bmWidth, bm.bmHeight, // dest extents
hdcMemory, // src DC
0,0, // src origin
SRCCOPY ); // ROP code
SelectObject(hdcMemory, hbmOld);
}
DeleteDC(hdcMemory);
ReleaseDC(hWnd, hDC);
return(0);
}
The actual error message I get is:
Code:
[name, line no.]error C2440: '=' : cannot convert from 'HGDIOBJ' to 'HBITMAP'
Conversion from 'void*' to pointer to non- 'void' requires an explicit cast
which occurs at the point I have indicated in the source code. I have tried many variants on the above code, but the error remains. Can anyone tell me what I am doing wrong ?
peternkelly