|
'in a module
Declare Function GetProp Lib "user32" Alias "GetPropA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Declare Function SetProp Lib "user32" Alias "SetPropA" (ByVal hwnd As Long, ByVal lpString As String, ByVal hData As Long) As Long
Declare Function RemoveProp Lib "user32" Alias "RemovePropA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Declare Function EnumProps Lib "user32" Alias "EnumPropsA" (ByVal hwnd As Long, ByVal lpEnumFunc As Long) As Long
Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long
Function PropEnumProc(ByVal hwnd As Long, ByVal lpszString As Long, ByVal hData As Long) As Boolean
Dim Buffer As String
'create ab buffer
Buffer = Space(lstrlen(lpszString) + 1)
'copy the string to the buffer
lstrcpy Buffer, lpszString
'show the buffer
Form1.Print Buffer
'continue enumeration
PropEnumProc = True
End Function
'in a form
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'set the form's graphic mode to persistent
Me.AutoRedraw = True
'create a new property and set its value to 123
SetProp Me.hwnd, "TestProp", 123
'retrieve the value and show it
MsgBox "Property Value:" + Str(GetProp(Me.hwnd, "TestProp"))
'begin the enumeration
EnumProps Me.hwnd, AddressOf PropEnumProc
'remove the property
RemoveProp Me.hwnd, "TestProp"
End Sub
|
|