To retrieve data from the clipboard, an application takes these steps:
An application begins an interaction to retrieve data from the clipboard by calling XmClipboardStartRetrieve. The application passes a display pointer, a timestamp, and the ID of a window in the application. The application must pass the same window ID to subsequent clipboard calls in this sequence that it uses in the call to XmClipboardStartRetrieve. XmClipboardStartRetrieve locks the clipboard.
After calling XmClipboardStartRetrieve, the application makes one or more calls to XmClipboardRetrieve to retrieve data from the clipboard, converted to a given target. The application passes XmClipboardRetrieve a buffer to receive the data. If this buffer is not large enough to contain all the data for the given target, XmClipboardRetrieve returns XmClipboardTruncate. The application can make repeated calls to XmClipboardRetrieve to retrieve the remainder of the data. The function XmClipboardInquireLength returns the length of the data on the clipboard for the given target. This allows the application to allocate a buffer of the correct size.
XmClipboardEndRetrieve unlocks the clipboard and ends the interaction.