EnumPropsEx Function

Declare Function EnumPropsEx Lib "user32.dll" Alias "EnumPropsExA" (ByVal hWnd As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long

Platforms

Description & Usage

EnumPropsEx enumerates all of the window properties of a window. Information about each property is passed, one at a time, to the specified callback function. The window properties are not enumerated in any particular order.

Return Value

If the window had no window properties set, the function returns -1. Otherwise, the function returns whatever the most recent value the callback function returned was.

Visual Basic-Specific Issues

None.

Parameters

hWnd
A handle to the window to enumerate the window properties of.
lpEnumFunc
A pointer to the PropEnumProcEx callback function which receives information about each enumerated window property.
lParam
An additional value to pass to the function specified by lpEnumFunc.

Example

' This code is licensed according to the terms and conditions listed here.

' List the names of each window property belonging to window
' Form1.  This example does not display the actual data in the properties
' because the callback function is not told what the handle for each
' property refers to.

' *** Place the following code in a module. ***
' This callback function merely displays the name of the window property
' it is given.
Public Function PropEnumProcEx(ByVal hwnd As Long, ByVal lpszString As Long, ByVal hData As Long, ByVal dwData As Long) As Long
  Dim propname As String  ' receives the name of the window property
  Dim retval As Long  ' generic return value

  ' Copy the string pointed to by lpString into a "real" string.
  propname = Space(lstrlen(lpszString))
  retval = lstrcpy(propname, lpszString)
  ' Display the property name (not including its value).
  Debug.Print "- "; propname

  ' Tell EnumPropsEx to continue enumeration.
  PropEnumProcEx = 1
End Function

' *** Place the following code wherever you wish to enumerate the properties.
Dim retval As Long  ' result of enumeration

Debug.Print "BEGINNING ENUMERATION OF Form1's PROPERTIES"
' Enumerate the properties of window Form1.
retval = EnumPropsEx(Form1.hWnd, AddressOf PropEnumProcEx, 0)
If retval = -1 Then  ' no properties to enumerate
  Debug.Print "(no window properties were found)"
End If

Category

Window Properties

Go back to the alphabetical Function listing.
Go back to the Reference section index.


Last Modified: December 24, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/e/enumpropsex.html