# OLERECT type
{: .no_toc }

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](https://learn.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect), which holds the coordinates of the upper-left and lower-right corners of a rectangle.

```tb inert=signature
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**](/tB/Modules/Information/VarPtr.md), fits it:

- [**IOleObject.DoVerb**](/tB/Packages/Contributed/OLEGuids/IOleObject.md#doverb) -- *lprcPosRect*
- [**IOleInPlaceObject.SetObjectRects**](/tB/Packages/Contributed/OLEGuids/IOleInPlaceObject.md#setobjectrects) -- *lprcPosRect* and *lprcClipRect*
- [**IOleInPlaceActiveObject.ResizeBorder**](/tB/Packages/Contributed/OLEGuids/IOleInPlaceActiveObject.md#resizeborder) -- *prcBorder*
- [**IOleInPlaceUIWindow.GetBorder**](/tB/Packages/Contributed/OLEGuids/IOleInPlaceUIWindow.md#getborder) -- *lpRectBorder*
- [**IOleInPlaceUIWindow.RequestBorderSpace**](/tB/Packages/Contributed/OLEGuids/IOleInPlaceUIWindow.md#requestborderspace) and [**SetBorderSpace**](/tB/Packages/Contributed/OLEGuids/IOleInPlaceUIWindow.md#setborderspace) -- *pBorderWidths*, a `RECT` that holds four widths
- [**IOleInPlaceSite.GetWindowContext**](/tB/Packages/Contributed/OLEGuids/IOleInPlaceSite.md#getwindowcontext) -- *lprcPosRect* and *lprcClipRect*
- [**IOleInPlaceSite.OnPosRectChange**](/tB/Packages/Contributed/OLEGuids/IOleInPlaceSite.md#onposrectchange) -- *lprcPosRect*

## Example

This function asks a frame or document window for its border rectangle and returns the width of the rectangle.

```tb check_build
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](/tB/Packages/Contributed/OLEGuids/OLEPOINT.md) type -- a point
- [OLESIZE](/tB/Packages/Contributed/OLEGuids/OLESIZE.md) type -- a width and a height
- [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
