WinQueryPresParam
Appearance
Posts a message to the message queue associated with the window defined by hwnd.
Syntax
WinQueryPresParam(hwnd, idAttrType1, idAttrType2, pidAttrTypeFound, cbAttrValueLen, pAttrValue, flOptions)
Parameters
- hwnd (HWND) - input
- Window handle whose presentation is to be queried.
- idAttrType1 (ULONG) - input
- First presentation parameter to retrieve.
- This identifies the first presentation parameter attribute to be queried.
- It can be zero to reference no presentation parameter attribute.
- idAttrType2 (ULONG) - input
- Second presentation parameter to retrieve.
- This identifies the second presentation parameter attribute to be queried.
- It can be zero to reference no presentation parameter attribute.
- pidAttrTypeFound (PULONG) - in/out
- Presentation parameter attribute found.
- This identifies which of the presentation parameter attributes idAttrType1
- and idAttrType2 has been found. This parameter can be passed as NULL (if, for
- example, only one attribute is being queried).
- cbAttrValueLen (ULONG) - input
- Size of the buffer pointed to by the pAttrValue parameter.
- pAttrValue (PPVOID) - output
- Attribute value.
- The value of the presentation parameter attribute found.
- flOptions (ULONG) - input
- Options controlling the query.
- Any of the following values can be ORed together:
- QPF_NOINHERIT
- For the purposes of this query, presentation parameters are not
- inherited from the owners of the window specified by hwnd. If not specified (default)
- , presentation parameters are inherited.
- QPF_ID1COLORINDEX
- idAttrType1 refers to a color index presentation parameter
- attribute, the value of which, if found, is to be converted to RGB before being passed
- back in pAttrValue.
- QPF_ID2COLORINDEX
- idAttrType2 refers to a color index presentation parameter
- attribute, the value of which, if found, is to be converted to RGB before being passed
- back in pAttrValue.
- QPF_PURERGBCOLOR
- Specifies that either or both of idAttrType1 and idAttrType2
- reference RGB color, and that these colors must be pure. This is necessary when
- specifying text foreground and background colors. This is applied after QPF_
- ID1COLORINDEX and QPF_ID2COLORINDEX.
Returns
- cbRetLen (ULONG) - returns
- Length of presentation parameter value passed
- back.
- Zero
- Presentation parameter not found or error occurred
- Other
- Length of presentation parameter value passed back in pAttrValue.
Remarks
Two presentation parameter attribute identities can be passed, and both will be searched for along the chain of owners of the window hwnd (subject to QPF_ NOINHERIT). The first one found satisfies the query. If both idAttrType1 and idAttrType2 are present for the same window, idAttrType1 takes precedence. If the presentation parameter attribute value is too long to fit in the pAttrValue buffer provided, it is truncated, and the number of bytes copied is returned in cbRetLen. (See also WinSetPresParam and WinRemovePresParam.)
Example Code
#define INCL_WINSYS /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwnd; /* Window handle whose presentation is to be queried. */ ULONG idAttrType1; /* First presentation parameter to retrieve. */ ULONG idAttrType2; /* Second presentation parameter to retrieve. */ PULONG pidAttrTypeFound; /* Presentation parameter attribute found. */ ULONG cbAttrValueLen; /* Size of the buffer pointed to by the pAttrValue parameter. */ PVOID pAttrValue; /* Attribute value. */ ULONG flOptions; /* Options controlling the query. */ ULONG cbRetLen; /* Length of presentation parameter value passed back. */ cbRetLen = WinQueryPresParam(hwnd, idAttrType1, idAttrType2, pidAttrTypeFound, cbAttrValueLen, pAttrValue, flOptions);
This example queries the disable-foreground attribute; if it is a valid attribute of the window, it is removed via WinRemovePresParam.
#define INCL_WINSYS #include <OS2.H> HWND hwnd; ULONG AttrFound; ULONG AttrValue[32]; ULONG cbRetLen; cbRetLen = WinQueryPresParam(hwnd, PP_DISABLEDFOREGROUNDCOLORINDEX, 0, &AttrFound, sizeof(AttrValue), &AttrValue, QPF_ID1COLORINDEX | QPF_NOINHERIT); if(PP_DISABLEDFOREGROUNDCOLORINDEX == AttrFound) WinRemovePresParam(hwnd, PP_DISABLEDFOREGROUNDCOLORINDEX);