CalculatePopupWindowPosition function
Applies to: desktop apps only
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 WINAPI CalculatePopupWindowPosition( __in const POINT *anchorPoint, __in const SIZE *windowSize, __in UINT flags, __in_opt RECT *excludeRect, __out RECT *popupWindowPosition );
Parameters
- anchorPoint [in]
-
Type: const POINT*
The specified anchor point.
- windowSize [in]
-
Type: const SIZE*
The specified window size.
- flags [in]
-
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 - TPM_WORKAREA
- 0x10000L
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.
- excludeRect [in, optional]
-
Type: RECT*
A pointer to a structure that specifies the exclude rectangle. It can be NULL.
- popupWindowPosition [out]
-
Type: RECT*
A pointer to a structure that specifies the pop-up window position.
Return value
Type:
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
|
Minimum supported client | Windows 7 |
|---|---|
|
Minimum supported server | Windows Server 2008 R2 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Reference
- TrackPopupMenu
- TrackPopupMenuEx
Send comments about this topic to Microsoft
Build date: 2/3/2012