Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function adds a new entry or changes an existing entry in the property list of a specified window.

Syntax

BOOL SetProp(
  HWND 
hWnd,
  LPCTSTR 
lpString,
  HANDLE 
hData
);

Parameters

hWnd

[in] Handle to the window for which you want to add or change an entry in the property list.

lpString

[in] Pointer to a null-terminated character string that identifies the property that you want to add or change, or a global atom that identifies the string. If this parameter is a global atom, the application must create the atom by previously calling the GlobalAddAtomfunction. The application must place the atom, a 16-bit value, in the low-order word of the lpStringparameter; the high-order word of lpStringmust then be zero.

hData

[in] Handle to the data that you want to copy to the property list. The data handle can identify any value useful to the application.

Return Value

A nonzero value indicates that the data handle and string were successfully added to the property list. 0 indicates failure. To get extended error information, call GetLastError.

Remarks

SetPropadds a new entry to the list if the specified character string does not exist already in the list. The new entry contains the string and the handle. If the list already contains the specified character string, SetPropreplaces the current handle associated with the string with the specified handle.

Before an application returns from processing a WM_DESTROYmessage and destroys a window, an application should remove all entries that the application added to the property list for the window by calling RemovePropfor each entry.

Requirements

Header windows.h
Library coredll.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also