Declare Function GetProp Lib "user32.dll" Alias "GetPropA" (ByVal hWnd As Long, ByVal lpString As String) As Long
GetProp retrieves the value of one of the window properties of a window. The function obtains a handle to whatever object was associated with the window property.
If successful, the function returns a handle to the object associated with the window property. If the desired window property could not be found, the function returns 0.
None.
' This code is licensed according to the terms and conditions listed here. ' Read the "LookupFile" property of window Form1 and display it. ' This property is set by the example for the SetProp function -- ' the value is a string specifying a filename. Dim hData As Long, pData As Long ' handle and pointer to the property's data Dim strvalue As String ' receives the value of the window property (in this case) Dim retval As Long ' return value ' Get a handle to the window property's data. hData = GetProp(Form1.hWnd, "LookupFile") ' If that property didn't exist, alert the user. If hData = 0 Then Debug.Print "There is no property called 'LookupFile'." Else ' Get a pointer to the data retrieved. pData = GlobalLock(hData) ' Copy the string data into the string. strvalue = Space(lstrlen(pData)) retval = lstrcpy(strvalue, pData) ' Unlock the data block. retval = GlobalUnlock(hData) ' Display the string gotten from the data block. Debug.Print "LookupFile = "; strvalue End If
SetProp
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/g/getprop.html