| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 
 |  
// -------------------------------------------------------------------
void GetCaptionRect(CWnd *pWnd,CRect& rect)
{		
	DWORD dwStyle=pWnd->GetStyle();
 
	CSize szFrame=(dwStyle & WS_THICKFRAME) ?	
		CSize(GetSystemMetrics(SM_CXSIZEFRAME), GetSystemMetrics(SM_CYSIZEFRAME)) :
		CSize(GetSystemMetrics(SM_CXFIXEDFRAME), GetSystemMetrics(SM_CYFIXEDFRAME));
 
	// coordonnée fenetre	
	pWnd->GetWindowRect(rect);		
	// mise a l'origine 0,0
	rect-=CPoint(rect.left,rect.top);	
	// frame
	rect.left+=szFrame.cx;				
	// frame
	rect.right-=szFrame.cx;				
	// top 
	rect.top+=szFrame.cy;				
	// height:tient compte si TOOLWINDOW 
	rect.bottom=rect.top+
		(((pWnd->GetExStyle() & WS_EX_TOOLWINDOW)==WS_EX_TOOLWINDOW) ? 
		GetSystemMetrics(SM_CYSMCAPTION) : GetSystemMetrics(SM_CYCAPTION))-
		GetSystemMetrics(SM_CYBORDER);
 
	if(pWnd->IsIconic())
	{
		rect.InflateRect(1,1,1,-1);
	}
} | 
Partager