Bonjours,
J'essaie d'afficher sur le fond de la fenêtre de mon application, une image au format BMP.
Je l'ai déclaré dans les ressources, j'essaie en suite de l'utiliser, et j'ai une Violation d'acces mémoire. J'ai récupéré un bout de code que j'ai essayé de transormer.
Et dans le resource.rc :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 case WM_PAINT: HDC hdc; HDC hdcMemory; PAINTSTRUCT ps; hdc = BeginPaint(hWnd, &ps); BITMAP bm; hbitmap = (HBITMAP)LoadImage(hInstance, MAKEINTRESOURCE("BGSTEP1"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); hdcMemory = CreateCompatibleDC(NULL); SelectObject(hdcMemory, hbitmap); GetObject(hbitmap, sizeof(bm), &bm); BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMemory, 0, 0, SRCCOPY); DeleteDC(hdcMemory); EndPaint(hWnd, &ps); break;
Merci de votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part BGSTEP1 BITMAP "BgStep1.bmp"
Partager