int EnumProps(hWnd,lpEnumFunc)
This function enumerates all entries in the property list of the specified window. It enumerates the entries by passing them, one by one, to the callback function specified by lpEnumFunc. EnumProps continues until the last entry is enumerated or the callback function returns zero.
Parameter | Type/Description |
hWnd | HWND Identifies the window whose property list is to be enumerated. | |
lpEnumFunc | FARPROC Is the procedure-instance address of the callback function. See the following “Comments” section for details. |
The return value specifies the last value returned by the callback function. It is –1 if the function did not find a property for enumeration.
An application can remove only those properties which it has added. It should not remove properties added by other applications or by Windows itself.
The following restrictions apply to the callback function:
1.The callback function must not yield control or do anything that might yield control to other tasks.
2.The callback function can call the RemoveProp function. However, the RemoveProp function can remove only the property passed to the callback function through the callback function's parameters.
3.A callback function should not attempt to add properties.
The address passed in the lpEnumFunc parameter must be created by using the MakeProcInstance function.
The callback function must use the Pascal calling convention and must be declared FAR. In applications and dynamic libraries with fixed data segments and in dynamic libraries with moveable data segments that do not contain a stack, the callback function must have the form shown below.
Callback Function
int FAR PASCAL EnumFunc(hWnd, lpString, hData)
HWND hWnd;
LPSTR lpString;
HANDLE hData;
EnumFunc is a placeholder for the application-supplied function name. The actual name must be exported by including it in an EXPORTS statement in the application's module-definition file.
Parameter | Description |
hWnd | Identifies a handle to the window that contains the property list. | |
lpString | Points to the null-terminated character string associated with the data handle when the application called the SetProp function to set the property. If the application passed an atom instead of a string to the SetProp function, the lpString parameter contains the atom in its low-order word, and the high-order word is zero. | |
hData | Identifies the data handle. |
Return Value
The callback function can carry out any desired task. It must return a nonzero value to continue enumeration, or a zero value to stop it.
The callback function must use the Pascal calling convention and must be declared FAR. In applications with moveable data segments and in dynamic libraries whose moveable data segments also contain a stack, the callback function must have the form shown below.
Callback Function
int FAR PASCAL EnumFunc(hWnd, nDummy, pString, hData)
HWND hWnd;
WORD nDummy;
PSTR pString;
HANDLE hData;
EnumFunc is a placeholder for the application-supplied function name. The actual name must be exported by including it in an EXPORTS statement in the application's module-definition file.
Parameter | Description |
hWnd | Identifies a handle to the window that contains the property list. | |
nDummy | Specifies a dummy parameter. | |
pString | Points to the null-terminated character string associated with the data handle when the application called the SetProp function to set the property. If the application passed an atom instead of a string to the SetProp function, the pString parameter contains the atom. | |
hData | Identifies the data handle. |
Return Value
The callback function can carry out any desired task. It should return a nonzero value to continue enumeration, or a zero value to stop it.
Comments
The alternate form above is required since movement of the data will invalidate any long pointer to a variable on the stack, such as the lpString parameter. The data segment typically moves if the callback function allocates more space in the local heap than is currently available.