예제 #1
0
BOOL CTrayIconPosition::GetTrayIconPosition(CPoint& a_ptPoint, TrackType a_eTrackType, Precision a_ePrec)
{
	if(m_hWndOfIconOwner == NULL || m_iTrayIconID == -1)
	{
		return -1;
	}
	
	//remove it if you need exact point of left/top corner of the icon
	const int iOffsetX = 4;
	const int iOffsetY = 6;

	CRect rcDirectRect;
	
	switch (a_eTrackType) 
	{
	case UseBothTechniquesDirectPrefered:
		if( FindOutPositionOfIconDirectly(m_hWndOfIconOwner, m_iTrayIconID, rcDirectRect) == FALSE )
		{
			return GetTrayIconPositionVisualScan(a_ptPoint, a_ePrec);
		}
		
		a_ptPoint.x = rcDirectRect.left + iOffsetX;
		a_ptPoint.y = rcDirectRect.top  + iOffsetY;
		return TRUE;

	case UseBothTechniquesVisualScanPrefered:
		if( GetTrayIconPositionVisualScan(a_ptPoint, a_ePrec) == FALSE )
		{
			BOOL bOK = FindOutPositionOfIconDirectly(m_hWndOfIconOwner, m_iTrayIconID, rcDirectRect);

			a_ptPoint.x = rcDirectRect.left + iOffsetX;
			a_ptPoint.y = rcDirectRect.top  + iOffsetY;
			return bOK;
		}
		return TRUE;

	case UseDirectOnly:
		{
			BOOL bOK = FindOutPositionOfIconDirectly(m_hWndOfIconOwner, m_iTrayIconID, rcDirectRect);

			a_ptPoint.x = rcDirectRect.left + iOffsetX;
			a_ptPoint.y = rcDirectRect.top  + iOffsetY;
			return bOK;
		}

	case UseVisualScanOnly:
		return GetTrayIconPositionVisualScan(a_ptPoint, a_ePrec);
		
	default:
		ASSERT(0);
		break;
	}
	

	return FALSE;
}
예제 #2
0
BOOL CTrayIconPosition::GetTrayIconPosition(CPoint& a_ptPoint, Precision a_ePrec)
{
	if(m_hWndOfIconOwner == NULL || m_iTrayIconID == -1)
	{
		return -1;
	}
	
	
	const int iOffsetX = 4;
	const int iOffsetY = 6;

	CRect rcDirectRect;

	BOOL bOK = FindOutPositionOfIconDirectly(m_hWndOfIconOwner, m_iTrayIconID, rcDirectRect);

	a_ptPoint.x = rcDirectRect.left + iOffsetX;
	a_ptPoint.y = rcDirectRect.top  + iOffsetY;
	return bOK;
}