if (COM.OleGetClipboard(ppv) != COM.S_OK) return null;
int retryCount = 0; int result = COM.OleGetClipboard(ppv); 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.OleGetClipboard(ppv); } if (result != COM.S_OK) return null;
public Object getContents(Transfer transfer) {	checkWidget();	if (transfer == null) DND.error(SWT.ERROR_NULL_ARGUMENT);	int[] ppv = new int[1];	if (COM.OleGetClipboard(ppv) != COM.S_OK) return null;	IDataObject dataObject = new IDataObject(ppv[0]);	try {		TransferData[] allowed = transfer.getSupportedTypes();		for (int i = 0; i < allowed.length; i++) {			if (dataObject.QueryGetData(allowed[i].formatetc) == COM.S_OK) {				TransferData data = allowed[i];				data.pIDataObject = ppv[0];				return transfer.nativeToJava(data);			}		}			} finally {		dataObject.Release();	}	return null; // No data available for this transfer}