OS.GlobalFree(rgelt); enumFormatetc.Release(); return types; }
private FORMATETC[] _getAvailableTypes() {	FORMATETC[] types = new FORMATETC[0];	int[] ppv = new int[1];	if (COM.OleGetClipboard(ppv) != COM.S_OK) return types;	IDataObject dataObject = new IDataObject(ppv[0]);	int[] ppFormatetc = new int[1];	int rc = dataObject.EnumFormatEtc(COM.DATADIR_GET, ppFormatetc);	dataObject.Release();	if (rc != COM.S_OK)return types;	IEnumFORMATETC enum = new IEnumFORMATETC(ppFormatetc[0]);	// Loop over enumerator and save any types that match what we are looking for	int rgelt = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, FORMATETC.sizeof);	int[] pceltFetched = new int[1];	enum.Reset();	while (enum.Next(1, rgelt, pceltFetched) == COM.S_OK && pceltFetched[0] == 1) {		FORMATETC formatetc = new FORMATETC();		COM.MoveMemory(formatetc, rgelt, FORMATETC.sizeof);		FORMATETC[] newTypes = new FORMATETC[types.length + 1];		System.arraycopy(types, 0, newTypes, 0, types.length);		newTypes[types.length] = formatetc;		types = newTypes;	}