peter s kelly 0 Newbie Poster

I am trying to recompile a games program I first wrote about 12 years ago. It compiled then with a V. 1 C++ compiler and has run since on Windows 95, 98, XP and Vista machines. But it will not run on my new Windows 7 machine, hence the need to recompile with a Windows 7 C++ compiler which I have purchased. The problem I can not get over occurs in the following function:

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);

    HDC = GetDC(hWnd);
    hdcMemory = CreateCompatibleDC(hDC);
    hbmOld = SelectObject(hdcMemory, hbmOut);     // Error C2440 occurs at this point

    if(hbmOld)
    {
      /* Blit the image in the new position */
      BitBlt( hDC,          // dst DC
        xx, yy,               // dest origin
        bm.bmWidth, bm.bmHeight,    // dest extents
        hdcMemory,                  // src DC
        0, 0,
        SRCCOPY  );                 // ROP code
      SelectObject(hdcMemory, hbmOld);
    }
  DeleteDC(hdcMemory);
  ReleaseDC(hWnd, HDC);
return(0);
}

The actual error message for the line I have indicated in the above is:

error C2440: '=' : cannot convert from 'HGDIOBJ' to 'HBITMAP'
Conversion frpm 'void*' to pointer to non- 'void' requires an explicit cast

Can anyone shed some light on how to get around this problem ? I have tried everything I know,

Regards,

Peter S Kelly, e-mail noggykelly@gmail.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.