Declare Function RemoveProp Lib "user32.dll" Alias "RemovePropA" (ByVal hWnd As Long, ByVal lpString As String) As Long
RemoveProp removes a window property from a window. This property must have been previously set using the SetProp function. Your program must remove all window properties it creates before the window they are attached to closes. However, never remove any window properties not created by your program. Although this function deletes the property itself, it does not affect the data referenced by the property in any way.
If an error occured, the function returns 0. If successful, the function returns a handle to the data which was attached to the property. The program is then responsible for deallocating this data, if necessary.
None.
' This code is licensed according to the terms and conditions listed here.
' Set the "LookupFile" property of window Form1 to a string.
' This example also shows how to remove the property.
Dim hStr As Long, pStr As Long ' handle and pointer to the string
Dim thevalue As String ' the string referenced by the handle
Dim retval As Long ' return value
' Set the value of the string (this could be anything, really).
thevalue = "C:\Icons\default.ico"
' Create a memory block...
hStr = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(thevalue))
' ...and copy the string into it.
pStr = GlobalLock(hStr) ' get a pointer to the block
retval = lstrcpy(pStr, text) ' copy the string
retval = GlobalUnlock(hStr) ' release the pointer
' The handle hStr now refers to a memory block holding the string. Set
' the "LookupFile" property to this memory block.
retval = SetProp(Form1.hWnd, "LookupFile", hStr)
' Note how we cannot yet free the memory block since it is still in use.
' *** INSERT OTHER CODE (such as the GetProp example) HERE ***
' The following code releases the "LookupFile" property and frees
' the memory block to which it points.
' (this code assumes the same Dims as above)
hStr = RemoveProp(Form1.hWnd, "LookupFile")
' The property is gone; now free the memory block.
retval = GlobalFree(hStr)
Go back to the alphabetical Function listing.
Go back to the Reference section index.
Last Modified: December 23, 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/r/removeprop.html