Retrieving a Window Property (Windows CE 5.0)
To retrieve the window property identified by a specified string, call the GetProp function. A window can create handles to the data contained in the window properties of the window and use the data for any purpose.
The following code example shows how to use GetProp to obtain handles to the window properties identified by the strings PROP_ICON, PROP_CURSOR, and PROP_BUFFER. The example then displays the contents of the newly obtained memory buffer, cursor, and icon in the client area of the window.
HWND hwndSubclass; // Handle to a subclassed window
HANDLE hIconProp, hCursProp;
TCHAR *lpFilename;
TCHAR tchBuffer[MAX_PATH];
int nSize;
HDC hdc;
HRESULT hr;
// Get the window properties, then print the data.
hIconProp = (HICON) GetProp(hwndSubclass, TEXT("PROP_ICON"));
ExtTextOut(hdc, 10, 40, 0, NULL, TEXT("PROP_ICON"),
_tcslen(TEXT("PROP_ICON")), NULL);
DrawIcon(hdc, 90, 40, (HICON)hIconProp);
hCursProp = (HCURSOR) GetProp(hwndSubclass, TEXT("PROP_CURSOR"));
ExtTextOut(hdc, 10, 85, 0, NULL, TEXT("PROP_CURSOR"),
_tcslen(TEXT("PROP_CURSOR")), NULL);
DrawIcon(hdc, 110, 85, (HICON)hCursProp);
lpFilename = (TCHAR*) GetProp(hwndSubclass, TEXT("PROP_BUFFER"));
hr = StringCchPrintf(tchBuffer, MAX_PATH, TEXT("Path to file: %s"),
lpFilename);
ExtTextOut(hdc, 10, 10, 0, NULL, tchBuffer, nSize, NULL);
See Also
Send Feedback on this topic to the authors