now i have a big Problem with this HB_FUNC
Code: Select all
HB_FUNC(BMP_PAINT)
{
HWND hWnd;
HBITMAP hBitmap;
HDC memDC, hDC;
RECT rect;
RECT aSource;
BITMAP bm;
int nMode;
hWnd = (HWND) hb_parnl (1);
hBitmap = (HBITMAP) hb_parnl (2);
nMode = hb_parni (3);
GetClientRect(hWnd, &rect);
458 // hDC = GetDC (hWnd); // obtine un hDC para toda el area del cliente (se puede pintar en cualquier lugar del area del cliente)
459 PAINTSTRUCT ps;
460 hDC = BeginPaint (hWnd, &ps); // obtiene un hDC solo para el area invalida (area que debe ser repintada) en un mensaje WM_PAINT
if (nMode == BMP_ERASE)
FillRect(hDC,&rect,(HBRUSH) GetSysColorBrush(COLOR_BTNFACE));
else
{
FillRect(hDC,&rect,(HBRUSH) GetSysColorBrush(COLOR_BTNFACE)); // borra la imagen anterior antens de asignar otra
memDC = CreateCompatibleDC(hDC);
SelectObject(memDC, hBitmap);
rect.top = hb_parnl (4);
rect.left = hb_parnl (5);
if (nMode == BMP_COPY_NORMAL)
{
rect.bottom = hb_parnl (6);
rect.right = hb_parnl (7);
BitBlt(hDC, rect.left, rect.top, rect.right, rect.bottom, memDC, 0, 0, SRCCOPY);
}
GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
if (nMode == BMP_COPY_SCALE)
{ if ((int) bm.bmWidth * rect.bottom / bm.bmHeight <= rect.right)
rect.right= (int) bm.bmWidth * rect.bottom / bm.bmHeight;
else
rect.bottom = (int) bm.bmHeight * rect.right / bm.bmWidth;
StretchBlt(hDC, rect.left, rect.top, rect.right, rect.bottom, memDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
}
if (nMode == BMP_COPY_SPLIT)
{
rect.bottom = hb_parnl (6);
rect.right = hb_parnl (7);
aSource.top = hb_parnl (8);
aSource.left = hb_parnl (9);
aSource.bottom = hb_parnl (10);
aSource.right = hb_parnl (11);
StretchBlt(hDC, rect.left, rect.top, rect.right, rect.bottom, memDC, aSource.left, aSource.top, aSource.right, aSource.bottom, SRCCOPY);
}
if (nMode == BMP_COPY_STRETCH)
StretchBlt(hDC, rect.left, rect.top, rect.right, rect.bottom, memDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
DeleteDC(memDC);
}
//EndPaint (hWnd, hDC); //Elimina el hDC y Valida el area pintada
ReleaseDC(hWnd, hDC); //Elimina el hDC pero NO Valida el area pintada
//Al no validar el area pintada permite que los procesos de pintura siguientes encadenados puedan usar hDC = BeginPaint (hWnd, &ps);
}
how to do it with FiveWin when i'm not allowed to use PAINTSTRUCT psError E2140 hmg_uhr.prg 459: Declaration is not allowed here in function HB_FUN_BMP_PAINT
*** 1 errors in Compile ***