IMsoComponent::HwndGetWindow Method

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Retrieves a window that is associated with the component.

HWND HwndGetWindow(
   DWORD dwWhich,
   DWORD dwReserved


  • dwWhich [in]
    The window for which to obtain the window handle (HWND). The possible values are specified in the following table.



    msocWindowFrameToplevel = 0

    Specifies the top frame window. Multiple-document interface (MDI) applications should return the MDI frame (not the MDI client) or the application frame window. Single-document interface (SDI) applications should return the frame window that hosts the component. This should be the topmost window that owns the component.

    msocWindowFrameOwner = 1

    Specifies the window that owns the component. The window may be the same as the top frame window, or may be an owned window of the top frame window.

    msocWindowComponent = 2

    Specifies the main window of the component.

    msocWindowDlgOwner = 3

    Specifies that the caller needs to display a dialog box to be owned by the component. The component should return a window that is suitable for use as the dialog box's owner window.

  • dwReserved [in]
    Reserved for future use. Should be 0.

Return Value

The handle to the window associated with the component. If this method fails or the window does not exist, NULL is returned.

See Also


IMsoComponent Interface