IE 窗口可以有多个选项卡。我想使用 P/Invoke 选择具有匹配标题的选项卡。我已经有代码可以遍历所有选项卡并检查此类选项卡是否存在。
参考 P/Inoke:http:
//msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx
while ((tabNum++ <= 15) &&
(curChild = FindWindowEx(parentHwnd, curChild, "TabWindowClass", IntPtr.Zero)) != IntPtr.Zero)
{
String sb = GetWindowTitle(curChild);
if (sb.Contains(expectedTitleString))
{
//TODO : I want to select this tab here.
foundTab = true;
break;
}
if (is_ie8)
{
parentHwnd = FindWindowEx(hWnd, parentHwnd, "Frame Tab", IntPtr.Zero);
curChild = IntPtr.Zero;
}
}