public static CopyHGlobal ( |
||
data | ||
Résultat |
void IDataObject.GetData(FORMATETC[] fmt, STGMEDIUM[] m) { STGMEDIUM retMedium = new STGMEDIUM(); if (fmt == null || fmt.Length < 1) { return; } foreach (DataCacheEntry e in this.entries) { if (e.Format.cfFormat == fmt[0].cfFormat /*|| fmt[0].cfFormat == InternalNativeMethods.CF_HDROP*/) { retMedium.tymed = e.Format.tymed; // Caller must delete the memory. retMedium.unionmember = DragDropHelper.CopyHGlobal(new IntPtr(e.Data)); break; } } if (m != null && m.Length > 0) { m[0] = retMedium; } }
void IDataObject.GetData(FORMATETC[] fmt, STGMEDIUM[] m) { STGMEDIUM retMedium = new STGMEDIUM(); if (fmt == null || fmt.Length < 1) { return; } SafeGlobalAllocHandle copy = null; foreach (DataCacheEntry e in this.entries) { if (e.Format.cfFormat == fmt[0].cfFormat /*|| fmt[0].cfFormat == InternalNativeMethods.CF_HDROP*/) { retMedium.tymed = e.Format.tymed; // Caller must delete the memory. copy = DragDropHelper.CopyHGlobal(e.Data); retMedium.unionmember = copy.DangerousGetHandle(); break; } } if (m != null && m.Length > 0) { m[0] = retMedium; if (copy != null) { copy.SetHandleAsInvalid(); } } }