-
February 25th, 2010, 01:00 PM
#1
[RESOLVED] getting the handles ?
how can i get the handles of
1) the start button on the task bar
and
2)the systemtray on the task bar
-
February 25th, 2010, 02:14 PM
#2
Re: getting the handles ?
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
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
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.)
-
February 25th, 2010, 02:36 PM
#3
Re: getting the handles ?
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
Another way to approach this (and a more reliable way, imo) is to use Active Accessibility
what is Active Accessibility ?
-
February 25th, 2010, 03:25 PM
#4
Re: getting the handles ?
Originally Posted by dskp
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
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.
Originally Posted by dskp
what is Active Accessibility ?
What is google?
-
February 26th, 2010, 01:34 AM
#5
Re: getting the handles ?
my question was wrong .
i want popup menu's handle.sorry .
Code:
CWnd* m_Window = CWnd::FindWindow("Shell_TrayWnd","");
HWND hStartbtn = (HWND)m_Window->GetTopWindow();
//what should i do after this
how to get start button popup menu handle ?
-
February 26th, 2010, 05:41 AM
#6
Re: getting the handles ?
i got it .
used
Code:
HWND hStartMenu = ::FindWindow(_T("DV2ControlHost"), NULL);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|