CalculatePopupWindowPosition function (winuser.h)
Calculates an appropriate pop-up window position using the specified anchor point, pop-up window size, flags, and the optional exclude rectangle. When the specified pop-up window size is smaller than the desktop window size, use the CalculatePopupWindowPosition function to ensure that the pop-up window is fully visible on the desktop window, regardless of the specified anchor point.
Syntax
BOOL CalculatePopupWindowPosition(
[in] const POINT *anchorPoint,
[in] const SIZE *windowSize,
[in] UINT flags,
[in, optional] RECT *excludeRect,
[out] RECT *popupWindowPosition
);
Parameters
[in] anchorPoint
Type: const POINT*
The specified anchor point.
[in] windowSize
Type: const SIZE*
The specified window size.
[in] flags
Type: UINT
Use one of the following flags to specify how the function positions the pop-up window horizontally and vertically. The flags are the same as the vertical and horizontal positioning flags of the TrackPopupMenuEx function.
Use one of the following flags to specify how the function positions the pop-up window horizontally.
Uses one of the following flags to specify how the function positions the pop-up window vertically.
Use one of the following flags to specify whether to accommodate horizontal or vertical alignment.
The following flag is available starting with Windows 7.
Value | Meaning |
---|---|
|
Restricts the pop-up window to within the work area. If this flag is not set, the pop-up window is restricted to the work area only if the input point is within the work area. For more information, see the rcWork and rcMonitor members of the MONITORINFO structure. |
[in, optional] excludeRect
Type: RECT*
A pointer to a structure that specifies the exclude rectangle. It can be NULL.
[out] popupWindowPosition
Type: RECT*
A pointer to a structure that specifies the pop-up window position.
Return value
Type: BOOL
If the function succeeds, it returns TRUE; otherwise, it returns FALSE. To get extended error information, call GetLastError.
Remarks
TPM_WORKAREA is supported for the TrackPopupMenu and TrackPopupMenuEx functions.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 [desktop apps only] |
Minimum supported server | Windows Server 2008 R2 [desktop apps only] |
Target Platform | Windows |
Header | winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |
See also
Reference