Visual C++ / Vista

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • HGallon

    Visual C++ / Vista

    I am transferring some of my code (half written games, etc) from an old
    (Win98) PC to a laptop running Vista.

    The following function no longer works.

    void DisplayBitmap (char* filename, UINT width, UINT height)
    {
    HANDLE hBitmap = ::LoadImage (g_hInstance, filename,
    IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );

    PAINTSTRUCT ps;
    HDC hDC = ::BeginPaint (hWnd, &ps);
    HDC memDC = ::CreateCompati bleDC (hDC);
    HGDIOBJ hObj = ::SelectObject (memDC, hBitmap);
    BOOL bRes = ::BitBlt (hDC, 0, 0, width, height,
    memDC, 0, 0, SRCCOPY);

    ::DeleteDC (memDC);
    ::EndPaint (hWnd, &ps);
    ::DeleteObject (hBitmap);

    ::InvalidateRec t (hWnd, &rect, true);
    }

    Everything returns TRUE or valid handles, but I get a white screen.

    Any ideas?


    ** Posted from http://www.teranews.com **
  • asm23

    #2
    Re: Visual C++ / Vista

    HGallon wrote:
    I am transferring some of my code (half written games, etc) from an old
    (Win98) PC to a laptop running Vista.
    >
    The following function no longer works.
    >
    void DisplayBitmap (char* filename, UINT width, UINT height)
    {
    HANDLE hBitmap = ::LoadImage (g_hInstance, filename,
    IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );
    >
    PAINTSTRUCT ps;
    HDC hDC = ::BeginPaint (hWnd, &ps);
    HDC memDC = ::CreateCompati bleDC (hDC);
    HGDIOBJ hObj = ::SelectObject (memDC, hBitmap);
    BOOL bRes = ::BitBlt (hDC, 0, 0, width, height,
    memDC, 0, 0, SRCCOPY);
    >
    ::DeleteDC (memDC);
    ::EndPaint (hWnd, &ps);
    ::DeleteObject (hBitmap);
    >
    ::InvalidateRec t (hWnd, &rect, true);
    }
    >
    Everything returns TRUE or valid handles, but I get a white screen.
    >
    Any ideas?
    >
    >
    ** Posted from http://www.teranews.com **
    Please post in * windows * related forums.

    Comment

    Working...