how can i get the handles of
1) the start button on the task bar
and
2)the systemtray on the task bar
Printable View
how can i get the handles of
1) the start button on the task bar
and
2)the systemtray on the task bar
You can use the Spy++ tool ( VisualCInstallFolder\Common7\Tools) to grab the window hierarchy from the desktop and then use FindWindowEx to navigate to the desired button/window.
On my machine running XP, from the destop the hierarchy is as follows
Another way to approach this (and a more reliable way, imo) is to use Active Accessibility. AA gives you more control over accessing UI entities that may not be available using other windowing techniques (like FindWindow, EnumWindows, etc.)Code:
Title Class
Root NULL #32769 (Desktop)
L NULL Shell_Tray
L "start" Button
L NULL TrayNotifyWnd
L "11:02 AM" TrayClockWClass
L NULL SysPager
L NULL Button
1)HWND hShellTrayWnd = ::FindWindow(_T("Shell_TrayWnd"), NULL);
2) HWND hStartButton = ::FindWindowEx(hShellTrayWnd,0,"Button","start");
i got system traywindow handle .
but start buttons handle.what wrong with 2 plz correct
what is Active Accessibility ?Quote:
Another way to approach this (and a more reliable way, imo) is to use Active Accessibility
Code:HWND hShellTrayWnd = NULL, hStartBtn = NULL;
if( NULL != ( hShellTrayWnd = ::FindWindowEx( NULL, NULL, _T("Shell_TrayWnd"), NULL ) ) )
{
hStartBtn = ::FindWindowEx( hShellTrayWnd, NULL, _T("Button"), _T("start") );
}
Again, this works on XP. For other operation systems like Vista and Win7, the hierarchy, class names and/or title names may change.
What is google?
my question was wrong .
i want popup menu's handle.sorry .
how to get start button popup menu handle ?Code:
CWnd* m_Window = CWnd::FindWindow("Shell_TrayWnd","");
HWND hStartbtn = (HWND)m_Window->GetTopWindow();
//what should i do after this
i got it .
used
Code:
HWND hStartMenu = ::FindWindow(_T("DV2ControlHost"), NULL);