Check out the below sample code that will help you to get started:
Code:
#define Title 0x130
BOOL CALLBACK EnumChildProc
(
HWND hwnd,
LPARAM lParam
)
{
TCHAR szWindowText[256];
HWND* lpHwndReceiver = (HWND*)lParam;
GetWindowText
(
hwnd,
szWindowText,
sizeof(szWindowText)
);
if (_tcscmp(szWindowText, TEXT("start")) == 0)
{
LONG_PTR lValTemp = GetWindowLongPtr
(
hwnd,
GWLP_ID
);
if (lValTemp == Title)
{
*lpHwndReceiver = hwnd;
return FALSE;
}
}
return TRUE;
}
void GetStartButton1(HWND& hWndStartButtonReceiver)
{
hWndStartButtonReceiver = NULL;
HWND hWndShellTrayWindow = NULL;
hWndShellTrayWindow = FindWindow(TEXT("Shell_TrayWnd"), NULL);
if (hWndShellTrayWindow)
{
EnumChildWindows
(
hWndShellTrayWindow,
EnumChildProc,
(LPARAM)&hWndStartButtonReceiver
);
}
}
int _tmain(int argc, _TCHAR* argv[])
{
HWND hWndStartButton = NULL;
GetStartButton1(hWndStartButton);
return 0;
}
Bookmarks