have the following code ...
case WM_PAINT:
{
hdc = BeginPaint(hwnd,&paintSt);
temphdc = hdc;
GetClientRect(hwnd,&aRect);
if(hBitmap!=NULL)
{
HDC memDC = CreateCompatibleDC(hdc);
if(memDC!=NULL)
{
BITMAP bmp;
GetObject(hBitmap,sizeof(bmp),&bmp);
SelectObject(memDC,hBitmap);
SetStretchBltMode(hdc,HALFTONE);
StretchBlt(hdc,0,0,aRect.right,aRect.bottom,
memDC,0,0,bmp.bmWidth,bmp.bmHeight,
SRCCOPY);
DeleteObject(&bmp);
DeleteDC(memDC);
SendMessage(picBoxCrop,STM_SETIMAGE,NULL,NULL);
}
}
EndPaint(hwnd,&paintSt);
}
break;
..... now here is the code from the proc of picBoxCrop
LRESULT CALLBACK cropWndProc(HWND hwnd,UINT msg, WPARAM wParam, LPARAM lParam)
{
static HDC hdc;
PAINTSTRUCT paintSt;
RECT aRect;
switch(msg)
{
case WM_PAINT:
{
hdc = BeginPaint(hwnd,&paintSt);
GetClientRect(hwnd,&aRect);
if(hBitmap!=NULL)
{
HDC memDC = CreateCompatibleDC(hdc);
if(memDC!=NULL)
{
SelectObject(memDC,hBitmap);
if(StretchBlt(hdc,0,0,aRect.right,aRect.bottom,
memDC,0,0,100,100,SRCCOPY)==false)
{
MessageBox(NULL,"StretchBlt()
failed...","Error!! Bad Programming.",MB_OK);
}
}
else
MessageBox(NULL,"memDC of cropDisp cant be
created","Error!! Bad Programming.",MB_OK);
DeleteDC(memDC);
}
EndPaint(hwnd,&paintSt);
}
break;
case STM_SETIMAGE:
{
InvalidateRect(hwnd,&aRect,true);
}
break;
case WM_CREATE:
{}break;
case WM_ERASEBKGND:
{
InvalidateRect(hwnd,&aRect,true);
}break;
default:
return DefWindowProc(hwnd,msg,wParam,lParam);
}
return 0;
}
Now the problem is .... the image in picBoxCrop is displayed when we minimize or disable the window once (by bringing some other window to front)... once that is done after that both the images are displayed correctly...
My objective here is to crop the part of the image from the original box to this picBoxCrop....
I am a newbie in WIN32 programming. . .. . . any help will be appreciated...
thanks in advance,
[edit]Code block added, "Ignore HTML..." option disabled - OriginalGriff[/edit]