Compartir a través de


Deleting a Window Property (Windows Embedded CE 6.0)

1/6/2010

To destroy the association between a window and a window property, call the RemoveProp function. RemoveProp destroys the association between a window and a window property, but it does not destroy the data itself. To destroy the data itself, use the appropriate function to free the handle that RemoveProp returns. When an application destroys a window, the application must also destroy any window properties that the application set.

The following code example shows how to use the EnumPropsEx function and the application-defined DelPropProc callback function to destroy the properties associated with the window identified by the application-defined hwndSubclass variable. The code example also shows how the callback function uses the RemoveProp function to remove the association between the window and the properties associated with the window.

case WM_DESTROY: 
 
    EnumPropsEx(hwndSubclass, DelPropProc, NULL); 
 
    PostQuitMessage(0); 
    break; 
 
// DelPropProc is an application-defined callback function 
// that deletes a window property. 
 
BOOL CALLBACK DelPropProc( 
    HWND hwndSubclass,  // Handle to a window with a property 
    LPTSTR lpszString,  // Property string or atom 
    HANDLE hData,       // Data handle 
    ULONG_PTR dwData)   // Application-defined data, set to NULL in this
                        // example
{ 
    hData = RemoveProp(hwndSubclass, lpszString); 
//
// If appropriate, free the handle hData.
//
 
    return TRUE; 
}

See Also

Concepts

Using Window Properties