Hello my prob is as follows:
I need to paint an object to the window from anoher void function...and need to access the function at any given moment to paint only then and not when the window is loaded.SO I did create my function as follows:
Code:
void DrawBall(HWND hwnd)
{
BITMAP bm;
PAINTSTRUCT ps;
RECT rcClient;
HBITMAP hbmOld;
HDC hdcMem;
int y_axis=10;
int x_axis=40;
HDC hdc = BeginPaint(hwnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
for(i=1;i<=4;i++)
{
hdcMem = CreateCompatibleDC(hdc);
hbmOld = SelectObject(hdcMem, g_hbmimg[i]);
GetObject(g_hbmimg[i], sizeof(bm), &bm);
if (i==3)
{
y_axis=380;
x_axis=-40;
}
BitBlt(hdc, x_axis*(i), y_axis,bm.bmWidth,bm.bmHeight, hdcMem, 0, 0, SRCAND);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
}
EndPaint(hwnd, &ps);
}
and accessed it from my the case WM_PAINT: to try to paint it on load first..but the BMP wont be painted
btw I passed the hwnd so as to be able to paint on the window..
DrawBall(hwnd);
am I wrong ? or am I totally wrong?
Using DEV C++ and WIN XP