void SuperbikeControl::GetChildWindow(CWnd *cwnd)
{
CWnd *wnd = cwnd->GetWindow (GW_CHILD);
if (wnd != NULL)
{
wnd->PostMessageW (WM_KEYDOWN, VK_ESCAPE, 0);
Sleep(50);
wnd->PostMessageW (WM_KEYUP, VK_ESCAPE, 0);
PlaySound(_T("sound\\bell.wav"), NULL, SND_FILENAME | SND_ASYNC);
Sleep(1000);
GetChildWindow(wnd);
}
else
{
wnd = cwnd->GetWindow (GW_HWNDNEXT);
if (wnd != NULL)
{
wnd->PostMessageW (WM_KEYDOWN, VK_ESCAPE, 0);
Sleep(50);
wnd->PostMessageW (WM_KEYUP, VK_ESCAPE, 0);
PlaySound(_T("sound\\bell.wav"), NULL, SND_FILENAME | SND_ASYNC);
Sleep(1000);
GetChildWindow(wnd);
}
}
{
CWnd *wnd = cwnd->GetWindow (GW_CHILD);
if (wnd != NULL)
{
wnd->PostMessageW (WM_KEYDOWN, VK_ESCAPE, 0);
Sleep(50);
wnd->PostMessageW (WM_KEYUP, VK_ESCAPE, 0);
PlaySound(_T("sound\\bell.wav"), NULL, SND_FILENAME | SND_ASYNC);
Sleep(1000);
GetChildWindow(wnd);
}
else
{
wnd = cwnd->GetWindow (GW_HWNDNEXT);
if (wnd != NULL)
{
wnd->PostMessageW (WM_KEYDOWN, VK_ESCAPE, 0);
Sleep(50);
wnd->PostMessageW (WM_KEYUP, VK_ESCAPE, 0);
PlaySound(_T("sound\\bell.wav"), NULL, SND_FILENAME | SND_ASYNC);
Sleep(1000);
GetChildWindow(wnd);
}
}
}
本文转自博客园知识天地的博客,原文链接:遍历子窗口 ,如需转载请自行联系原博主。