Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
To enumerate all of the properties for a window, call the EnumPropsEx function. EnumPropsEx passes the property entries to an application-defined callback function that you specify in the lpEnumFunc parameter when you call EnumPropsEx. For information about the callback function and a definition of the callback function prototype, see PropEnumProcEx. PropEnumProcEx is a placeholder for the application-defined function name.
The following code example shows how to use the EnumPropsEx function to list the string identifiers of the window properties for the window identified by the application-defined hwndSubclass variable. This function relies on the application-defined WinPropProc callback function to display the strings in the client area of the window.
EnumPropsEx(hwndSubclass, WinPropProc, NULL);
// WinPropProc is an application-defined callback function
// that lists a window property.
BOOL CALLBACK WinPropProc(
HWND hwndSubclass, // Handle to window with a property
LPCSTR lpszString, // Property string or atom
HANDLE hData, // Data handle
ULONG_PTR dwData) // Application-defined data, set to NULL in this
// example
{
static int nProp = 1; // Property counter
TCHAR tchBuffer[BUFFER]; // Expanded-string buffer
int nSize; // Size of string in buffer
HDC hdc; // Device-context handle
HRESULT hr;
hdc = GetDC(hwndSubclass);
// Display window property string in client area.
hr = StringCchPrintf(tchBuffer, BUFFER, TEXT("WinProp %d: %s"),
nProp++, lpszString);
ExtTextOut(hdc, 10, nProp * 20, 0, NULL, tchBuffer, nSize, NULL);
ReleaseDC(hwndSubclass, hdc);
return TRUE;
}
See Also
Send Feedback on this topic to the authors