[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

Visual C++ / Vista

HGallon@teranews.com

9/27/2008 2:09:00 AM

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 = ::CreateCompatibleDC (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);

::InvalidateRect (hWnd, &rect, true);
}

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

Any ideas?


** Posted from http://www.te... **
1 Answer

asm23

9/30/2008 5:03:00 AM

0

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 = ::CreateCompatibleDC (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);
>
> ::InvalidateRect (hWnd, &rect, true);
> }
>
> Everything returns TRUE or valid handles, but I get a white screen.
>
> Any ideas?
>
>
> ** Posted from http://www.te... **
Please post in * windows * related forums.