# IOleWindow interface
{: .no_toc }

Returns the handle of a window that an OLE object or container uses, and turns context-sensitive help mode on and off.

**IOleWindow** has the interface identifier `00000114-0000-0000-C000-000000000046` and extends **stdole.IUnknown**. It is declared `[OleAutomation(False)]`. Microsoft Learn describes the Windows interface: [IOleWindow](https://learn.microsoft.com/en-us/windows/win32/api/oleidl/nn-oleidl-iolewindow).

It is the base of the in-place activation interfaces: [IOleInPlaceObject](/tB/Packages/Contributed/OLEGuids/IOleInPlaceObject.md), [IOleInPlaceUIWindow](/tB/Packages/Contributed/OLEGuids/IOleInPlaceUIWindow.md) (and through it [IOleInPlaceFrame](/tB/Packages/Contributed/OLEGuids/IOleInPlaceFrame.md)) and [IOleInPlaceSite](/tB/Packages/Contributed/OLEGuids/IOleInPlaceSite.md) extend it. Neither method is marked `[PreserveSig]`, so the HRESULT is hidden: a failure code raises a run-time error.

## Methods

### GetWindow

```tb inert=signature
Function GetWindow() As LongPtr
```

Returns the handle of one of the windows that take part in in-place activation: the frame, document, parent or in-place object window. The Windows method returns this handle through an output parameter; here it is the result.

### ContextSensitiveHelp

```tb inert=signature
Sub ContextSensitiveHelp(ByVal fEnterMode As Long)
```

Turns context-sensitive help mode on, when *fEnterMode* is not 0, or off, when it is 0. The mode is usually entered with Shift+F1, and the next click then asks for help on the item clicked.

## Example

This class reports one window handle, which it is given when it is created. Its **ContextSensitiveHelp** does nothing, because the class has no help mode.

```tb check_build projname=og-olewindow slot=file
Class WindowSite
    Implements IOleWindow

    Private m_hWnd As LongPtr

    Public Sub Init(ByVal hWnd As LongPtr)
        m_hWnd = hWnd
    End Sub

    Private Function IOleWindow_GetWindow() As LongPtr Implements IOleWindow.GetWindow
        Return m_hWnd
    End Function

    Private Sub IOleWindow_ContextSensitiveHelp(ByVal fEnterMode As Long) Implements IOleWindow.ContextSensitiveHelp
    End Sub
End Class
```

A caller asks the object for its window through the interface:

```tb check_run projname=og-olewindow
Dim site As New WindowSite
site.Init &H1234

Dim w As IOleWindow = site
Debug.Print Hex(w.GetWindow())  ' 1234
```

## See Also

- [IOleInPlaceObject](/tB/Packages/Contributed/OLEGuids/IOleInPlaceObject.md) interface -- activates and deactivates an object in place
- [IOleInPlaceUIWindow](/tB/Packages/Contributed/OLEGuids/IOleInPlaceUIWindow.md) interface -- border space in a frame or document window
- [IOleInPlaceSite](/tB/Packages/Contributed/OLEGuids/IOleInPlaceSite.md) interface -- the container-side site for in-place activation
