mrpinko
asked on
Finding the screen position of a system tray icon
hi gurus,
i have a system tray icon and would like to display a window at or around it. Is there any way i can get the location or dimensions of my tray icon?
thanks,
Gavin
i have a system tray icon and would like to display a window at or around it. Is there any way i can get the location or dimensions of my tray icon?
thanks,
Gavin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The sys tray is a child window of the task bar. Hence you can obtain the rect in the foll way.
HWND hWndTask = FindWindow(_T("Shell_TrayW
HWND hWndTray = NULL;
RECT rect;
for(HWND hWnd = GetWindow(hWndTask,GW_CHIL
{
TCHAR ClassName[MAX_PATH];
if (GetClassName(hWnd,ClassNa
{
if (0 == lstrcmp(_T ("TrayNotifyWnd"),ClassNam
{
hWndTray = hWnd;
break;
}
}
}
//get the rect in screen coordinates
GetWindowRect(hWndTray,&re