Re: Find DesktopRegion in MFC VC++




i dunno if this can help you or not.
its a routine i've used and always worked for me.

returns false if the APPBARDATA::uEdge is not set.
but even so you still get the desktop rectangle.

BOOL GetDeskTopRect(RECT &rect)
{
INT sw = GetDeviceCaps(::GetDC(0), HORZRES);
INT sh = GetDeviceCaps(::GetDC(0), VERTRES);

rect.left = 0;
rect.top = 0;
rect.right = sw;
rect.bottom = sh;

APPBARDATA barData = {0};
barData.cbSize = sizeof(APPBARDATA);

if( (BOOL)SHAppBarMessage(ABM_GETTASKBARPOS, &barData) == TRUE )
{
switch(barData.uEdge)
{
case ABE_LEFT:
rect.left = barData.rc.right;
break;
case ABE_RIGHT:
rect.right = barData.rc.left;
break;
case ABE_BOTTOM:
rect.bottom = barData.rc.top;
break;
case ABE_TOP:
rect.top = barData.rc.bottom;
break;
default :
return FALSE;
}
}

return TRUE;
}




.