WaitForTabWindow function

Waits for a tab window to become visible.


HRESULT WaitForTabWindow(
  _In_  BOOL allowUnknownThread,
  _In_  HWND proposedParentWindow,
  _Out_ HWND *pActualParentWindow


allowUnknownThread [in]

Threads in a tab process are associated with a tab window where possible. If this flag is FALSE and the thread is not associated with a tab window, the call will fail. Callers should default to FALSE. Pass TRUE for the call to work even if the thread is unnassociated.

proposedParentWindow [in]

Proposed parent window to be used by functions that require a HWND, such as CreateWindow, MessageBox, and ShellExecute. May be NULL.

pActualParentWindow [out]

Window handle that should be used as parent of new window.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


Modal dialogs must use the correct parent. Otherwise, Windows Internet Explorer will not be disabled, allowing the dialog to go behind the application window and allowing tabs to be switched while the dialog is showing.

This method checks whether the dialog is allowed and blocks execution on this thread until the corresponding tab is made active again. When the call returns, the correct parent window handle is returned in pActualParentWindow. You may pass NULL in proposedParentWindow to find the tab window associated with the current thread.

Note  This method invokes a minimal message pump while blocking, which creates the potential for reentrancy for scenarios such as modeless dialogs that did not previously pump messages.

The static method IEProcess::GetTabWindowExports returns a pointer to this function.


Minimum supported client

Windows XP with SP2

Minimum supported server

Windows Server 2003





See also