checkWidget(); if (data == null || dataTypes == null || data.length != dataTypes.length) { DND.error(SWT.ERROR_INVALID_ARGUMENT); }  this.data = data; this.transferAgents = dataTypes;  int result = COM.OleSetClipboard(this.iDataObject.getAddress());   int retryCount = 0; while (result != COM.S_OK && retryCount++ < 10) { try { Thread.sleep(50);} catch (Throwable t) {} MSG msg = new MSG(); COM.PeekMessage (msg, 0, 0, 0, OS.PM_NOREMOVE | OS.PM_NOYIELD); result = COM.OleSetClipboard(this.iDataObject.getAddress()); } if (result != COM.S_OK) { DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD); }
setContents(data, dataTypes, DND.CLIPBOARD);
public void setContents(Object[] data, Transfer[] dataTypes) {	checkWidget();	if (data == null || dataTypes == null || data.length != dataTypes.length) {		DND.error(SWT.ERROR_INVALID_ARGUMENT);	}		this.data = data;	this.transferAgents = dataTypes;	int result = COM.OleSetClipboard(this.iDataObject.getAddress());		/*	* Bug in Windows. When a new application takes control	* of the clipboard, other applications may open the 	* clipboard to determine if they want to record the 	* clipoard updates.  When this happens, the clipboard 	* can not be flushed until the other application is	* finished.  To allow other applications to get the	* data, use PeekMessage() to enable cross thread	* message sends.	*/	int retryCount = 0;	while (result != COM.S_OK && retryCount++ < 10) {		try { Thread.sleep(50);} catch (Throwable t) {}		MSG msg = new MSG();		COM.PeekMessage (msg, 0, 0, 0, OS.PM_NOREMOVE | OS.PM_NOYIELD);		result = COM.OleSetClipboard(this.iDataObject.getAddress());	}	if (result != COM.S_OK) {		DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);	}}