If an application uses many data formats, it can save formatting time by passing NULL data handles to the SetClipboardData function, instead of generating all the data handles when the user chooses a Cut or Copy command. The application need not generate a data handle until another application requests a handle by calling the GetClipboardData function.
When the application calls the GetClipboardData function with a request for a format for which a NULL data handle has been set, Windows sends a WM_RENDERFORMAT message to the clipboard owner. When an application receives this message, it can do the following:
1.Format the data last copied to the clipboard (the wParam parameter of WM_RENDERFORMAT specifies the format being requested).
2.Allocate a global memory object and copy the formatted data to it.
3.Pass the global memory handle and the format number to the clipboard by using the SetClipboardData function.
To accomplish these steps, the application must maintain a record of the last data copied to the clipboard. The application may discard this data when it receives the WM_DESTROYCLIPBOARD message, which is sent to the clipboard owner whenever the clipboard is emptied by a call to the EmptyClipboard function.