OLERECT type
A rectangle, with the layout of the Windows RECT structure.
OLERECT is a user-defined type declared in the package’s OLEGuids module, so both OLERECT and OLEGuids.OLERECT name it. It mirrors the Windows structure RECT, which holds the coordinates of the upper-left and lower-right corners of a rectangle.
Public Type OLERECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Fields
- Left
- A Long holding the x coordinate of the upper-left corner.
- Top
- A Long holding the y coordinate of the upper-left corner.
- Right
- A Long holding the x coordinate of the lower-right corner.
- Bottom
- A Long holding the y coordinate of the lower-right corner.
Where it is used
No method of the package takes an OLERECT by name. The methods that take a RECT* declare the parameter as a LongPtr, and the address of an OLERECT variable, from VarPtr, fits it:
- IOleObject.DoVerb – lprcPosRect
- IOleInPlaceObject.SetObjectRects – lprcPosRect and lprcClipRect
- IOleInPlaceActiveObject.ResizeBorder – prcBorder
- IOleInPlaceUIWindow.GetBorder – lpRectBorder
- IOleInPlaceUIWindow.RequestBorderSpace and SetBorderSpace – pBorderWidths, a
RECTthat holds four widths - IOleInPlaceSite.GetWindowContext – lprcPosRect and lprcClipRect
- IOleInPlaceSite.OnPosRectChange – lprcPosRect
Example
This function asks a frame or document window for its border rectangle and returns the width of the rectangle.
Private Function BorderWidth(ByVal Window As IOleInPlaceUIWindow) As Long
Dim border As OLERECT
Window.GetBorder VarPtr(border)
Return border.Right - border.Left
End Function
See Also
- OLEPOINT type – a point
- OLESIZE type – a width and a height
- IOleInPlaceObject interface – activates and deactivates an object in place
- IOleInPlaceUIWindow interface – border space in a frame or document window