Hello, I'm trying to get from the screen, the region, or rectangle (the coordinated) of the part that is being painted. For example when I move some window or I have some action on the screen I want to get only that part of the screen image that is being painted (because it changed).
I try calling it inside WM_PAINT event before BeginPaint().
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
[...]
case WM_PAINT:{
RECT rectUpd;
if(hwnd!=NULL){
char s[100]="";
//hDesktop is desktop windown handler - GetDC(GetDesktopWindow());
GetUpdateRect (hDesktop, &rectUpd, FALSE);
c++;
sprintf(s,"Top:%d Left:%d Right:%d Bottom:%d",
rectUpd.top,
rectUpd.left,
rectUpd.right,
rectUpd.bottom);
//I set the window title with the values of the rectangle
SetWindowText(hwnd,s);
}
BeginPaint(hwnd,NULL);//hwnd is application window handler
}break;
[...]
}
}
I obtained only "-858993460" value for rectangle coordinates... Can somebody help me out how to detect the coordonates of the region painted on the screen?