IOleInPlaceObject interface
Lets a container deactivate an OLE object that is active in place, and tell the object where it is drawn.
IOleInPlaceObject has the interface identifier 00000113-0000-0000-C000-000000000046 and extends IOleWindow, so it also has that interface’s GetWindow and ContextSensitiveHelp methods. It is declared [OleAutomation(False)]. All four methods hide the HRESULT: a failure code raises a run-time error. Microsoft Learn describes the Windows interface: IOleInPlaceObject.
The declaration is complete: it has every method of the Windows interface.
Methods
InPlaceDeactivate
Sub InPlaceDeactivate()
Deactivates the object, which stops being active in place, and releases the resources it took for in-place activation.
UIDeactivate
Sub UIDeactivate()
Removes the object’s user interface, such as its menus and toolbars, from the container’s windows. The object stays active in place.
SetObjectRects
Sub SetObjectRects(ByVal lprcPosRect As LongPtr, ByVal lprcClipRect As LongPtr)
Tells the object how much of itself is visible. lprcPosRect points to a RECT holding the object’s position in its parent window, and lprcClipRect to a RECT holding the rectangle it must be clipped to. Both are pointers: pass the address of an OLERECT with VarPtr.
ReactivateAndUndo
Sub ReactivateAndUndo()
Reactivates an object that was deactivated, and undoes the changes made since it was activated.
Example
This procedure gives an in-place object a position and a clipping rectangle of the same size, with its upper-left corner at the origin of its parent window.
Private Sub PlaceObject(ByVal Obj As IOleInPlaceObject, ByVal Width As Long, ByVal Height As Long)
Dim area As OLERECT
area.Right = Width
area.Bottom = Height
Obj.SetObjectRects VarPtr(area), VarPtr(area)
End Sub
See Also
- IOleWindow interface – the base interface
- IOleInPlaceSite interface – the container-side site for in-place activation
- IOleInPlaceActiveObject interface – messages, activation and border changes for an in-place active object
- OLERECT type – a rectangle