Article ID: 179908
Article Last Modified on 7/11/2005
void CMainFrame::OnGetTaskbarPos() // Message handler.
{
// Get a pointer to the Windows task manager.
CWnd *pwnd = FindWindow("Shell_TrayWnd", NULL);
if (pwnd != NULL)
{
APPBARDATA abd;
abd.cbSize = sizeof(APPBARDATA);
abd.hWnd = phwnd->m_hWnd;
SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
UINT uEdge = GetEdge(abd.rc);
switch(uEdge)
{
case ABE_LEFT:
break;
case ABE_RIGHT:
break;
case ABE_TOP:
break;
case ABE_BOTTOM:
break;
default:
AfxMessageBox("abd.uEdge not found");
return;
}
}
}
UINT CMainFrame::GetEdge(CRect rc)
{
UINT uEdge = -1;
if (rc.top == rc.left && rc.bottom > rc.right)
{
uEdge = ABE_LEFT;
}
else if (rc.top == rc.left && rc.bottom < rc.right)
{
uEdge = ABE_TOP;
}
else if (rc.top > rc.left )
{
uEdge = ABE_BOTTOM;
}
else
{
uEdge = ABE_RIGHT;
}
return uEdge;
}
Keywords: kbhowto KB179908