Code:
case WM_PAINT:
//shall we draw?
ld = (P_LOCAL_DATA) GetWindowLong(hwnd, 0);
hdc = BeginPaint(hwnd, &ps);
if (lcs->v[ld->id].view__viewport.viewport__data != NULL)
{
bmi.bmiHeader.biWidth = lcs->v[ld->id].view__viewport.viewport__size_x;
bmi.bmiHeader.biHeight = lcs->v[ld->id].view__viewport.viewport__size_y;
long lines;
if (GDI_ERROR == (lines = SetDIBitsToDevice(hdc, 0, 0, lcs->v [ld->id].view__viewport.viewport__size_x,
lcs->v[ld->id].view__viewport.viewport__size_y, 0, 0,
0, lcs->v[ld->id].view__viewport.viewport__size_y,
(P_VOID) lcs->v[ld->id].view__viewport.viewport__data, &bmi, DIB_RGB_COLORS)))
}
EndPaint(hwnd, &ps);
break;
Code looks like this.
I tried SetDIBitsToDevice(), but to the same result. Those structs point to window-specific data (dimensions, memory area to be displayed..) and contain valid data, that is sure. Bmi struct is static and fully initialised in WM_CREATE, here is only local dimension specification.
Most important question (to me) is 'Can used function (setdibitstodevice or stretchdibits) return 0 drawn lines (as it does) even if all params are ok and it should draw +-hundreds of them???'
Small note: resizing of window does sometimes cause data to appear (eg. cause successfull draw) but it works other way as well - sometimes if i resize window with displayed data, new draw does not display anything...