Ciao ragazzi,
Mi succede una cosa assurda.
In essenza ho 2 finestre secondarie ciascuna delle quali contiene una bitmap; il codice è analogo per entrambe, ma quando effettuo un resize della finestra dell'applicazione... in una delle finestre secondarie l'immagine rimane e nell'altra sparisce.
Le finestre secondarie sono create nella window procedure primaria al WM_CREATE e quindi dimensionate al WM_SIZE.
Questo il codice:
-----------------------
// variabili globali per tutto il programma:
static HBITMAP hBmp1, hBmp2;
// window procedure 1 (o 2)
LRESULT CALLBACK WndProcPlayer (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc, hdcMem;
BITMAP bitmap;
static int n_ImgW, n_YmgH;
HINSTANCE hInstance;
(...)
case WM_CREATE:
hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
hBmp1 = LoadBitmap (hInstance, MAKEINTRESOURCE(IDB_1));
GetObject(hBmp1, sizeof(BITMAP), &bitmap);
n_ImgW = bitmap.bmWidth;
n_ImgH = bitmap.bmHeight;
return 0;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
SelectObject(hdcMem, hBmp1); // TODO implementare attraverso scelta utente
BitBlt(hdc, 0, 0, n_ImgW, n_ImgH, hdcMem, 0, 0, SRCCOPY);
EndPaint (hwnd, &ps);
return 0;
-----------------------
Qualche consiglio/idea?
Grazie
![]()

Rispondi quotando