load bitmap problem
Jan 8, 2015 at 5:13pm UTC
hiiii everyone
I am showing a bmp to my window with this manner
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
case WM_CREATE:
hInstance = ((LPCREATESTRUCT) lParam)−>hInstance ;
hBitmap = LoadBitmap (hInstance, TEXT ("pic01" )) ;
GetObject (hBitmap, sizeof (BITMAP), &bitmap) ;
cxSource = bitmap.bmWidth ;
cySource = bitmap.bmHeight ;
return 0 ;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
hdcMem = CreateCompatibleDC (hdc) ;
SelectObject (hdcMem, hBitmap) ;
BitBlt (hdc, x, y, cxSource, cySource, hdcMem, 0, 0, SRCCOPY) ;
DeleteDC (hdcMem) ;
EndPaint (hwnd, &ps) ;
return 0 ;
and it works perfectly ,but the problem is when I change the pic01.bmp with another .bmp ,it seems that the program(after compiling of course) only show the first one : is like the bmp resource is saved in the program
is there any other dynamic way that resolve this problem ?
Thanks a lot for you attention
Jan 8, 2015 at 7:02pm UTC
... is like the bmp resource is saved in the program.
It usually is. Are you changing the file name in the resource file and remembering to save it?
Topic archived. No new replies allowed.