static Win32DnD() { // Required for all other OLE functions to work Win32OleInitialize(IntPtr.Zero); // We reuse those DragDropEventArgs = new DragEventArgs(new DataObject(DataFormats.FileDrop, new string[0]), 0, 0, 0, DragDropEffects.None, DragDropEffects.None); DragFeedbackEventArgs = new GiveFeedbackEventArgs(DragDropEffects.None, true); DragContinueEventArgs = new QueryContinueDragEventArgs(0, false, DragAction.Continue); DragFormats = new ArrayList(); DragFormatArray = new FORMATETC[0]; DragMediums = new ArrayList(); // Set up delegates // IDataObject DOQueryInterface = new QueryInterfaceDelegate(ComIDataObject.QueryInterface); DOAddRef = new AddRefDelegate(ComIDataObject.AddRef); DORelease = new ReleaseDelegate(ComIDataObject.Release); GetData = new GetDataDelegate(ComIDataObject.GetData); GetDataHere = new GetDataHereDelegate(ComIDataObject.GetDataHere); QueryGetData = new QueryGetDataDelegate(ComIDataObject.QueryGetData); GetCanonicalFormatEtc = new GetCanonicalFormatEtcDelegate(ComIDataObject.GetCanonicalFormatEtc); SetData = new SetDataDelegate(ComIDataObject.SetData); EnumFormatEtc = new EnumFormatEtcDelegate(ComIDataObject.EnumFormatEtc); DAdvise = new DAdviseDelegate(ComIDataObject.DAdvise); DUnadvise = new DUnadviseDelegate(ComIDataObject.DUnadvise); EnumDAdvise = new EnumDAdviseDelegate(ComIDataObject.EnumDAdvise); // IDropSource DSQueryInterface = new QueryInterfaceDelegate(ComIDropSource.QueryInterface); DSAddRef = new AddRefDelegate(ComIDropSource.AddRef); DSRelease = new ReleaseDelegate(ComIDropSource.Release); QueryContinueDrag = new QueryContinueDragDelegate(ComIDropSource.QueryContinueDrag); GiveFeedback = new GiveFeedbackDelegate(ComIDropSource.GiveFeedback); // IDropTarget DTQueryInterface = new QueryInterfaceDelegate(ComIDropTarget.QueryInterface); DTAddRef = new AddRefDelegate(ComIDropTarget.AddRef); DTRelease = new ReleaseDelegate(ComIDropTarget.Release); DragEnter = new DragEnterDelegate(ComIDropTarget.DragEnter); DragOver = new DragOverDelegate(ComIDropTarget.DragOver); DragLeave = new DragLeaveDelegate(ComIDropTarget.DragLeave); Drop = new DropDelegate(ComIDropTarget.Drop); }