Ejemplo n.º 1
0
 /// <include file='doc\OleDataObject.uex' path='docs/doc[@for=OleDataObject.OleDataObject2]/*' />
 public OleDataObject(IComDataObject comData)
     : base(comData)
 {
     oleData = comData as IOleDataObject;
     if (null == oleData)
         this.oleData = (IOleDataObject)(new Ole2BclDataObject(comData));
 }
Ejemplo n.º 2
0
            public HRESULT QueryAcceptData(IComDataObject lpdataobj, IntPtr lpcfFormat, uint reco, BOOL fReally, IntPtr hMetaPict)
            {
                Debug.WriteLineIf(RichTextDbg.TraceVerbose, "IRichTextBoxOleCallback::QueryAcceptData(reco=" + reco + ")");
                if (reco == NativeMethods.RECO_PASTE)
                {
                    DataObject dataObj = new DataObject(lpdataobj);
                    if (dataObj != null &&
                        (dataObj.GetDataPresent(DataFormats.Text) || dataObj.GetDataPresent(DataFormats.UnicodeText)))
                    {
                        return(HRESULT.S_OK);
                    }

                    return(HRESULT.E_FAIL);
                }

                return(HRESULT.E_NOTIMPL);
            }
Ejemplo n.º 3
0
        /// <summary>
        /// OleGetClipboard - Call OLE Interop OleGetClipboard()
        /// </summary>
        internal int OleGetClipboard(ref IComDataObject dataObject)
        {
            if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
            {
                throw new ThreadStateException(SR.Get(SRID.OleServicesContext_ThreadMustBeSTA));
            }

            IntPtr comPtr = IntPtr.Zero;
            int    result = UnsafeNativeMethods.OleGetClipboard(ref comPtr);

            if (comPtr == IntPtr.Zero)
            {
                dataObject = null;
            }
            else
            {
                dataObject = (IComDataObject)Marshal.GetObjectForIUnknown(comPtr);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public static System.Runtime.InteropServices.ComTypes.IDataObject GetIDataObject(this IListItemEx[] items, out IntPtr dataObjectPtr)
        {
            var parent = items[0].Parent ?? items[0];

            var pidls = new IntPtr[items.Length];

            for (var i = 0; i < items.Length; i++)
            {
                pidls[i] = items[i].ILPidl;
            }
            var iidIDataObject = Ole32.IID_IDataObject;

            parent.GetIShellFolder().GetUIObjectOf(IntPtr.Zero, (UInt32)pidls.Length, pidls, ref iidIDataObject, 0, out dataObjectPtr);

            System.Runtime.InteropServices.ComTypes.IDataObject dataObj =
                (System.Runtime.InteropServices.ComTypes.IDataObject)
                Marshal.GetTypedObjectForIUnknown(dataObjectPtr, typeof(System.Runtime.InteropServices.ComTypes.IDataObject));

            return(dataObj);
        }
        public int DragEnter(IDataObject pDataObj, uint grfKeyState, tagPOINT pt, ref uint pdwEffect)
        {
            _currendDataObject = null;
              if (pDataObj != null)
            _currendDataObject = new DataObject (pDataObj);

              var args = new ExtendedDragEventHandlerArgs (
              _currendDataObject,
              (int) grfKeyState,
              pt.X,
              pt.Y,
              DragDropEffects.All,
              ToWinForms ((NativeDragDropEffects) pdwEffect));
              _extendedTridentWebBrowser.OnDragEnter (args);

              if (args.Handled)
            pdwEffect = (uint) ToNative (args.Effect);

              return HResult.S_OK;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Indicates whether a drop can be accepted, and, if so, the effect of the drop.
        /// </summary>
        /// <param name="pDataObj">A pointer to the IDataObject interface on the data object. This data object contains the data being transferred in the drag-and-drop operation. If the drop occurs, this data object will be incorporated into the target.</param>
        /// <param name="grfKeyState">The current state of the keyboard modifier keys on the keyboard. Possible values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.</param>
        /// <param name="pt">A POINTL structure containing the current cursor coordinates in screen coordinates.</param>
        /// <param name="pdwEffect">On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the DROPEFFECT flags, which indicates what the result of the drop operation would be.</param>
        /// <returns>
        /// This method returns S_OK on success.
        /// </returns>
        int IDropTarget.DragEnter(IDataObject pDataObj, uint grfKeyState, POINT pt, ref uint pdwEffect)
        {
            //  Log this key event.
            Log(string.Format("Drag Enter for item {0}", SelectedItemPath));

            //  Get the drag items.
            try
            {
                dragItems = pDataObj.GetFileList();
            }
            catch (Exception exception)
            {
                //  Log the error.
                LogError("An exception occured when getting the file list from the data object.", exception);
                return(WinError.E_UNEXPECTED);
            }

            //  Create drag event args, which store the provided parameters.
            var dragEventArgs = new DragEventArgs(null, (int)grfKeyState, pt.X, pt.Y, (DragDropEffects)pdwEffect, DragDropEffects.None);

            try
            {
                //  Call the main drag enter function.
                DragEnter(dragEventArgs);
            }
            catch (Exception exception)
            {
                //  Log the exception.
                LogError("An exception occured during a drag enter event.", exception);

                //  Don't allow any drag effect.
                dragEventArgs.Effect = DragDropEffects.None;
            }

            //  Set the effect.
            pdwEffect = (uint)dragEventArgs.Effect;

            //  Return success.
            return(WinError.S_OK);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Indicates whether a drop can be accepted, and, if so, the effect of the drop.
        /// </summary>
        /// <param name="pDataObj">A pointer to the IDataObject interface on the data object. This data object contains the data being transferred in the drag-and-drop operation. If the drop occurs, this data object will be incorporated into the target.</param>
        /// <param name="grfKeyState">The current state of the keyboard modifier keys on the keyboard. Possible values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.</param>
        /// <param name="pt">A POINTL structure containing the current cursor coordinates in screen coordinates.</param>
        /// <param name="pdwEffect">On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the DROPEFFECT flags, which indicates what the result of the drop operation would be.</param>
        /// <returns>
        /// This method returns S_OK on success.
        /// </returns>
        int IDropTarget.DragEnter(IDataObject pDataObj, uint grfKeyState, POINT pt, ref uint pdwEffect)
        {
            //  DebugLog this key event.
            Log(string.Format("Drag Enter for item {0}", SelectedItemPath));

            //  Get the drag items.
            try
            {
                dragItems = pDataObj.GetFileList();
            }
            catch (Exception exception)
            {
                //  DebugLog the error.
                LogError("An exception occured when getting the file list from the data object.", exception);
                return WinError.E_UNEXPECTED;
            }

            //  Create drag event args, which store the provided parameters.
            var dragEventArgs = new DragEventArgs(null, (int) grfKeyState, pt.X, pt.Y, (DragDropEffects) pdwEffect, DragDropEffects.None);

            try
            {
                //  Call the main drag enter function.
                DragEnter(dragEventArgs);
            }
            catch (Exception exception)
            {
                //  DebugLog the exception.
                LogError("An exception occured during a drag enter event.", exception);

                //  Don't allow any drag effect.
                dragEventArgs.Effect = DragDropEffects.None;
            }

            //  Set the effect.
            pdwEffect = (uint)dragEventArgs.Effect;

            //  Return success.
            return WinError.S_OK;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Incorporates the source data into the target window, removes target feedback, and releases the data object.
        /// </summary>
        /// <param name="pDataObj">A pointer to the IDataObject interface on the data object being transferred in the drag-and-drop operation.</param>
        /// <param name="grfKeyState">The current state of the keyboard modifier keys on the keyboard. Possible values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.</param>
        /// <param name="pt">A POINTL structure containing the current cursor coordinates in screen coordinates.</param>
        /// <param name="pdwEffect">On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the DROPEFFECT flags, which indicates what the result of the drop operation would be.</param>
        /// <returns>
        /// This method returns S_OK on success.
        /// </returns>
        int IDropTarget.Drop(IDataObject pDataObj, uint grfKeyState, POINT pt, ref uint pdwEffect)
        {
            //  Log this key event.
            Log(string.Format("Drop for item {0}", SelectedItemPath));

            //  Create drag event args, which store the provided parameters.
            var dragEventArgs = new DragEventArgs(null, (int)grfKeyState, pt.X, pt.Y, (DragDropEffects)pdwEffect, DragDropEffects.None);

            try
            {
                //  Perform the drop.
                Drop(dragEventArgs);
            }
            catch (Exception exception)
            {
                //  Log the exception.
                LogError("An exception occured during the drop event.", exception);
            }

            //  Return success.
            return(WinError.S_OK);
        }
        private void SetDragThumbnail(ComIDataObject dataObject)
        {
            var bitmap = new Bitmap(100, 100, PixelFormat.Format32bppArgb);

            using (var graphics = Graphics.FromImage(bitmap))
            {
                graphics.Clear(Color.Magenta);
                graphics.DrawEllipse(Pens.Blue, 20, 20, 60, 60);
            }

            var dragImage = new ShDragImage
            {
                sizeDragImage = bitmap.Size.ToWin32Size(),
                ptOffset      = new System.Windows.Point(50, 95).ToWin32Point(),
                hbmpDragImage = bitmap.GetHbitmap(),
                crColorKey    = Color.Magenta.ToArgb()
            };

            var dragHelper = (IDragSourceHelper) new DragDropHelper();

            dragHelper.InitializeFromBitmap(ref dragImage, dataObject);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Incorporates the source data into the target window, removes target feedback, and releases the data object.
        /// </summary>
        /// <param name="pDataObj">A pointer to the IDataObject interface on the data object being transferred in the drag-and-drop operation.</param>
        /// <param name="grfKeyState">The current state of the keyboard modifier keys on the keyboard. Possible values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.</param>
        /// <param name="pt">A POINTL structure containing the current cursor coordinates in screen coordinates.</param>
        /// <param name="pdwEffect">On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the DROPEFFECT flags, which indicates what the result of the drop operation would be.</param>
        /// <returns>
        /// This method returns S_OK on success.
        /// </returns>
        int IDropTarget.Drop(IDataObject pDataObj, uint grfKeyState, POINT pt, ref uint pdwEffect)
        {
            //  DebugLog this key event.
            Log(string.Format("Drop for item {0}", SelectedItemPath));

            //  Create drag event args, which store the provided parameters.
            var dragEventArgs = new DragEventArgs(null, (int)grfKeyState, pt.X, pt.Y, (DragDropEffects)pdwEffect, DragDropEffects.None);

            try
            {
                //  Perform the drop.
                Drop(dragEventArgs);
            }
            catch (Exception exception)
            {
                //  DebugLog the exception.
                LogError("An exception occured during the drop event.", exception);
            }

            //  Return success.
            return WinError.S_OK;
        }
Ejemplo n.º 11
0
 int UnsafeNativeMethods.IDocHostUIHandler.FilterDataObject(IComDataObject pDO, out IComDataObject ppDORet) 
 {
     //
     // Set to null no matter what we return, to prevent the marshaller
     // from going crazy if the pointer points to random stuff.
     ppDORet = null;
     return NativeMethods.E_NOTIMPL;
 }
Ejemplo n.º 12
0
            public int QueryAcceptData(IComDataObject lpdataobj,
                                       /* CLIPFORMAT* */ IntPtr lpcfFormat, int reco,
                                       int fReally, IntPtr hMetaPict) {
                                       
                Debug.WriteLineIf(RichTextDbg.TraceVerbose, "IRichEditOleCallback::QueryAcceptData(reco=" + reco + ")");

                if (reco == NativeMethods.RECO_DROP) {
                    if (owner.AllowDrop || owner.EnableAutoDragDrop) {
                        
                        MouseButtons b = Control.MouseButtons;
                        Keys k = Control.ModifierKeys;
                        
                        int keyState = 0;

                        // Due to the order in which we get called, we have to set up the keystate here.
                        // First GetDragDropEffect is called with grfKeyState == 0, and then
                        // QueryAcceptData is called. Since this is the time we want to fire
                        // OnDragEnter, but we have yet to get the keystate, we set it up ourselves.
                        
                        if ((b & MouseButtons.Left) == MouseButtons.Left) {
                            keyState |= NativeMethods.MK_LBUTTON;
                        }
                        
                        if ((b & MouseButtons.Right) == MouseButtons.Right) {
                            keyState |= NativeMethods.MK_RBUTTON;
                        }
                        
                        if ((b & MouseButtons.Middle) == MouseButtons.Middle) {
                            keyState |= NativeMethods.MK_MBUTTON;
                        }

                        if ((k & Keys.Control) == Keys.Control) {
                            keyState |= NativeMethods.MK_CONTROL;
                        }

                        if ((k & Keys.Shift) == Keys.Shift) {
                            keyState |= NativeMethods.MK_SHIFT;
                        }
                        
                        lastDataObject = new DataObject(lpdataobj);
                        
                        if (!owner.EnableAutoDragDrop) {
                            lastEffect = DragDropEffects.None;
                        }

                        DragEventArgs e = new DragEventArgs(lastDataObject, 
                                                        keyState, 
                                                        Control.MousePosition.X, 
                                                        Control.MousePosition.Y, 
                                                        DragDropEffects.All, 
                                                        lastEffect);
                        if (fReally == 0) {
                            // we are just querying

                            // We can get here without GetDragDropEffects actually being called first.
                            // This happens when you drag/drop between two rtb's. Say you drag from rtb1 to rtb2.
                            // GetDragDropEffects will first be called for rtb1, then QueryAcceptData for rtb1 just
                            // like in the local drag case. Then you drag into rtb2. rtb2 will first be called in this method,
                            // and not GetDragDropEffects. Now lastEffect is initialized to None for rtb2, so we would not allow
                            // the drag. Thus we need to set the effect here as well. 
                            e.Effect = ((keyState & NativeMethods.MK_CONTROL) == NativeMethods.MK_CONTROL) ? DragDropEffects.Copy : DragDropEffects.Move;
                            owner.OnDragEnter(e);
                        }
                        else {
                            owner.OnDragDrop(e);
                            lastDataObject = null;
                        }
                        
                        lastEffect = e.Effect;
                        if (e.Effect == DragDropEffects.None) {
                            Debug.WriteLineIf(RichTextDbg.TraceVerbose, "\tCancel data");
                            return NativeMethods.E_FAIL;
                        }
                        else {
                            Debug.WriteLineIf(RichTextDbg.TraceVerbose, "\tAccept data");
                            return NativeMethods.S_OK;
                        }
                    }
                    else {
                        Debug.WriteLineIf(RichTextDbg.TraceVerbose, "\tCancel data, allowdrop == false");
                        lastDataObject = null;
                        return NativeMethods.E_FAIL;
                    }
                }
                else {
                    return NativeMethods.E_NOTIMPL;
                }
            }
Ejemplo n.º 13
0
        internal int OleIsCurrentClipboard(IComDataObject dataObject) 
        {
            if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 
            {
                throw new ThreadStateException(SR.Get(SRID.OleServicesContext_ThreadMustBeSTA));
            }
 
            return UnsafeNativeMethods.OleIsCurrentClipboard(dataObject);
        } 
Ejemplo n.º 14
0
 public static extern int SHCreateShellItemArrayFromDataObject(
     System.Runtime.InteropServices.ComTypes.IDataObject pdo,
     ref Guid riid,
     [MarshalAs(UnmanagedType.Interface)] out IShellItemArray iShellItemArray);
 public int DragEnter(IDataObject pDataObj, int grfKeyState, Point pt, ref DragDropEffects pdwEffect) {
     fDraggingOnListView = parent.MouseIsOverListView();
     if(fDraggingOnListView) {
         parent.OnDragBegin();
     }
     using(DTWrapper wrapper = new DTWrapper(passthrough)) {
         return wrapper.DropTarget.DragEnter(pDataObj, grfKeyState, pt, ref pdwEffect);
     }
 }
Ejemplo n.º 16
0
 public static extern int SHMultiFileProperties(System.Runtime.InteropServices.ComTypes.IDataObject pdtobj, int flags);
Ejemplo n.º 17
0
 public static extern void DoDragDrop(System.Runtime.InteropServices.ComTypes.IDataObject dataObject, IDropSource dropSource, int allowedEffects, int[] finalEffect);
Ejemplo n.º 18
0
 public static extern int DoDragDrop(IDataObject pDataObject,
                                     IDropSource pDropSource, DragDropEffects dwOKEffect,
                                     out DragDropEffects pdwEffect);
Ejemplo n.º 19
0
 public int DragDrop(IDataObject pDataObj, int grfKeyState, Point pt, ref DragDropEffects pdwEffect)
 {
     parent.OnDragEnd();
     return(passthrough.DragDrop(pDataObj, grfKeyState, pt, ref pdwEffect));
 }
 int UnsafeNativeMethods.IDocHostUIHandler.FilterDataObject(System.Runtime.InteropServices.ComTypes.IDataObject pDO, out System.Runtime.InteropServices.ComTypes.IDataObject ppDORet)
 {
     ppDORet = null;
     return(UnsafeNativeMethods.HRESULT.S_OK);
 }
Ejemplo n.º 21
0
 HRESULT IOleObject.InitFromData(System.Runtime.InteropServices.ComTypes.IDataObject pDataObject, BOOL fCreation, uint dwReserved)
 {
     return(HRESULT.S_OK);
 }
Ejemplo n.º 22
0
		private void ShellTreeView_DragEnter(object sender, DragEventArgs e) {
			this._DataObject = (System.Runtime.InteropServices.ComTypes.IDataObject)e.Data;
			var wp = new DataObject.Win32Point() { X = e.X, Y = e.Y };
			ShellView.Drag_SetEffect(e);

			if (e.Data.GetDataPresent("DragImageBits"))
				DropTargetHelper.DropTarget.Create.DragEnter(this.Handle, (System.Runtime.InteropServices.ComTypes.IDataObject)e.Data, ref wp, (int)e.Effect);
			else
				base.OnDragEnter(e);
		}
Ejemplo n.º 23
0
 public void SendOnDataChange(System.Runtime.InteropServices.ComTypes.IDataObject dataObject, int dwReserved, System.Runtime.InteropServices.ComTypes.ADVF advf)
 {
     Invoke("SendOnDataChange", () => _dataAdviseHolder.SendOnDataChange(dataObject, dwReserved, advf));
 }
Ejemplo n.º 24
0
    void newt_DragEnter(object sender, DragEventArgs e) {
      e.Handled = true;
      this._CurrentlySelectedItem = tcMain.SelectedItem as Wpf.Controls.TabItem;
      var tabItem = e.Source as Wpf.Controls.TabItem;
      if (tabItem == null) return;

      this._TabDropData = (System.Runtime.InteropServices.ComTypes.IDataObject)e.Data;

      if ((sender as Wpf.Controls.TabItem).ShellObject.IsFileSystem)
        e.Effects = (e.KeyStates & DragDropKeyStates.ControlKey) == DragDropKeyStates.ControlKey ? DragDropEffects.Copy : DragDropEffects.Move;
      else
        e.Effects = DragDropEffects.None;

      var ptw = new BExplorer.Shell.DataObject.Win32Point();
      GetCursorPos(ref ptw);
      e.Effects = DragDropEffects.None;
      var tabItemSource = e.Data.GetData(typeof(Wpf.Controls.TabItem)) as Wpf.Controls.TabItem;

      if (tabItemSource == null) {
        var wpt = new BExplorer.Shell.DataObject.Win32Point() { X = ptw.X, Y = ptw.Y };
        DropTarget.Create.DragEnter(this.Handle, (System.Runtime.InteropServices.ComTypes.IDataObject)e.Data, ref wpt, (int)e.Effects);
      } else if (e.Data.GetDataPresent(typeof(Wpf.Controls.TabItem))) {
        e.Effects = DragDropEffects.Move;
      }
    }
 /// <summary>
 /// Extend node in data with this Snap-In
 /// </summary>
 /// <param name="data">IDataObject of node to extend</param>
 /// <param name="cns">MMC console namespace</param>
 /// <param name="hScope">HScopeItem for this Snap-In's root node</param>
 public void OnExtend(System.Runtime.InteropServices.ComTypes.IDataObject data, ref IConsoleNameSpace2 cns, int hScope)
 {
     this.RootNode.OnExpand(ref cns, hScope);
 }
 public int DragDrop(IDataObject pDataObj, int grfKeyState, Point pt, ref DragDropEffects pdwEffect) {
     parent.OnDragEnd();
     using(DTWrapper wrapper = new DTWrapper(passthrough)) {
         return wrapper.DropTarget.DragDrop(pDataObj, grfKeyState, pt, ref pdwEffect);
     }
 }
 public int DragDrop(IDataObject pDataObj, int grfKeyState, Point pt, ref DragDropEffects pdwEffect) {
     parent.OnDragEnd();
     return passthrough.DragDrop(pDataObj, grfKeyState, pt, ref pdwEffect);
 }
Ejemplo n.º 28
0
 int IDocHostUIHandler.FilterDataObject(System.Runtime.InteropServices.ComTypes.IDataObject pDO, out System.Runtime.InteropServices.ComTypes.IDataObject ppDORet)
 {
     ppDORet = null;
     return(Hresults.E_NOTIMPL);
 }
Ejemplo n.º 29
0
 public static extern int DoDragDrop(IComDataObject dataObject, UnsafeNativeMethods.IOleDropSource dropSource, int allowedEffects, int[] finalEffect);
Ejemplo n.º 30
0
        internal void OleDoDragDrop(IComDataObject dataObject, UnsafeNativeMethods.IOleDropSource dropSource, int allowedEffects, int[] finalEffect)
        { 
            if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
            {
                throw new ThreadStateException(SR.Get(SRID.OleServicesContext_ThreadMustBeSTA));
            } 

            InputManager inputManager = (InputManager)Dispatcher.CurrentDispatcher.InputManager; 
            if (inputManager != null) 
            {
                inputManager.InDragDrop = true; 
            }
            try
            {
                UnsafeNativeMethods.DoDragDrop(dataObject, dropSource, allowedEffects, finalEffect); 
            }
            finally 
            { 
                if (inputManager != null)
                { 
                    inputManager.InDragDrop = false;
                }
            }
        } 
Ejemplo n.º 31
0
 // Creates a new InkInteropObject instance.
 internal InkInteropObject(IComDataObject idataobject)
 {
     _idataobject = idataobject;
 }
Ejemplo n.º 32
0
 public int Drop(IDataObject pDataObj, uint grfKeyState, POINT pt, ref uint pdwEffect)
 {
     pdwEffect = (uint) (_dragDropHandler == null ? DragDropEffects.None : _dragDropHandler(pDataObj));
     return 0;
 }
Ejemplo n.º 33
0
 private static DragDropEffects DragEnterHandler(IDataObject dataObject)
 {
     Console.Out.WriteLine("DragEnterHandler");
     PrintFileList(dataObject);
     return DragDropEffects.Copy;
 }
 public int FilterDataObject(System.Runtime.InteropServices.ComTypes.IDataObject pDO,
                             out System.Runtime.InteropServices.ComTypes.IDataObject ppDORet)
 {
     ppDORet = null;
     return(S_FALSE);
 }
Ejemplo n.º 35
0
        private static void PrintFileList(IDataObject dataObject)
        {
            var dataObjectHelper = new DataObject(dataObject);
            StringCollection fileDropList = dataObjectHelper.GetFileDropList();

            foreach (string filePath in fileDropList)
            {
                Console.Out.WriteLine(" - {0}", filePath);
            }

            Console.Out.WriteLine();
        }
 public int DragEnter(IDataObject pDataObj, int grfKeyState, Point pt, ref DragDropEffects pdwEffect) {
     fDraggingOnListView = parent.MouseIsOverListView();
     if(fDraggingOnListView) {
         parent.OnDragBegin();
     }
     return passthrough.DragEnter(pDataObj, grfKeyState, pt, ref pdwEffect);
 }
Ejemplo n.º 37
0
 public static extern HResult OleSetClipboard(IDataObject pDataObj);
Ejemplo n.º 38
0
 HRESULT IOleObject.GetClipboardData(uint dwReserved, out System.Runtime.InteropServices.ComTypes.IDataObject ppDataObject)
 {
     ppDataObject = null;
     return(HRESULT.S_OK);
 }
Ejemplo n.º 39
0
            public HRESULT QueryAcceptData(IComDataObject lpdataobj, IntPtr lpcfFormat, RECO reco, BOOL fReally, IntPtr hMetaPict)
            {
                Debug.WriteLineIf(RichTextDbg.TraceVerbose, "IRichEditOleCallback::QueryAcceptData(reco=" + reco + ")");

                if (reco == RECO.DROP)
                {
                    if (owner.AllowDrop || owner.EnableAutoDragDrop)
                    {
                        MouseButtons b = Control.MouseButtons;
                        Keys         k = Control.ModifierKeys;

                        User32.MK keyState = 0;

                        // Due to the order in which we get called, we have to set up the keystate here.
                        // First GetDragDropEffect is called with grfKeyState == 0, and then
                        // QueryAcceptData is called. Since this is the time we want to fire
                        // OnDragEnter, but we have yet to get the keystate, we set it up ourselves.

                        if ((b & MouseButtons.Left) == MouseButtons.Left)
                        {
                            keyState |= User32.MK.LBUTTON;
                        }

                        if ((b & MouseButtons.Right) == MouseButtons.Right)
                        {
                            keyState |= User32.MK.RBUTTON;
                        }

                        if ((b & MouseButtons.Middle) == MouseButtons.Middle)
                        {
                            keyState |= User32.MK.MBUTTON;
                        }

                        if ((k & Keys.Control) == Keys.Control)
                        {
                            keyState |= User32.MK.CONTROL;
                        }

                        if ((k & Keys.Shift) == Keys.Shift)
                        {
                            keyState |= User32.MK.SHIFT;
                        }

                        lastDataObject = new DataObject(lpdataobj);

                        if (!owner.EnableAutoDragDrop)
                        {
                            lastEffect = DragDropEffects.None;
                        }

                        var e = new DragEventArgs(lastDataObject,
                                                  (int)keyState,
                                                  Control.MousePosition.X,
                                                  Control.MousePosition.Y,
                                                  DragDropEffects.All,
                                                  lastEffect);
                        if (fReally == 0)
                        {
                            // we are just querying

                            // We can get here without GetDragDropEffects actually being called first.
                            // This happens when you drag/drop between two rtb's. Say you drag from rtb1 to rtb2.
                            // GetDragDropEffects will first be called for rtb1, then QueryAcceptData for rtb1 just
                            // like in the local drag case. Then you drag into rtb2. rtb2 will first be called in this method,
                            // and not GetDragDropEffects. Now lastEffect is initialized to None for rtb2, so we would not allow
                            // the drag. Thus we need to set the effect here as well.
                            e.Effect = ((keyState & User32.MK.CONTROL) == User32.MK.CONTROL) ? DragDropEffects.Copy : DragDropEffects.Move;
                            owner.OnDragEnter(e);
                        }
                        else
                        {
                            owner.OnDragDrop(e);
                            lastDataObject = null;
                        }

                        lastEffect = e.Effect;
                        if (e.Effect == DragDropEffects.None)
                        {
                            Debug.WriteLineIf(RichTextDbg.TraceVerbose, "\tCancel data");
                            return(HRESULT.E_FAIL);
                        }
                        else
                        {
                            Debug.WriteLineIf(RichTextDbg.TraceVerbose, "\tAccept data");
                            return(HRESULT.S_OK);
                        }
                    }
                    else
                    {
                        Debug.WriteLineIf(RichTextDbg.TraceVerbose, "\tCancel data, allowdrop == false");
                        lastDataObject = null;
                        return(HRESULT.E_FAIL);
                    }
                }
                else
                {
                    return(HRESULT.E_NOTIMPL);
                }
            }
Ejemplo n.º 40
0
 uint Native.IDocHostUIHandler.FilterDataObject(IDataObject pDO, out IDataObject ppDORet)
 {
     ppDORet = null;
     return(E_NOTIMPL);
 }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        // Creates a new InkInteropObject instance.
        internal InkInteropObject(IComDataObject idataobject)
        {
            _idataobject = idataobject;
        }
Ejemplo n.º 42
0
 /// <summary>
 /// Get data about object we want properties for
 /// </summary>
 /// <param name="pidlFolder"></param>
 /// <param name="lpdobj"></param>
 /// <param name="hKeyProgID"></param>
 /// <returns></returns>
 int IShellExtInit.Initialize(IntPtr pidlFolder, IDataObject lpdobj, uint hKeyProgID)
 {
     dobj = lpdobj;
     return(0);
 }
Ejemplo n.º 43
0
 public void FilterDataObject(System.Runtime.InteropServices.ComTypes.IDataObject pDO, ref System.Runtime.InteropServices.ComTypes.IDataObject ppDORet)
 {
     if (this.m_defaultUIHandler != null)
     {
         this.m_defaultUIHandler.FilterDataObject(pDO, ref ppDORet);
     }
 }
Ejemplo n.º 44
0
 int UnsafeNativeMethods.IDocHostUIHandler.FilterDataObject(IComDataObject pDO, out IComDataObject ppDORet)
 {
     //
     // Set to null no matter what we return, to prevent the marshaller
     // from going crazy if the pointer points to random stuff.
     ppDORet = null;
     return(NativeMethods.E_NOTIMPL);
 }
Ejemplo n.º 45
0
 uint NativeMethods.IDocHostUIHandler.FilterDataObject(System.Runtime.InteropServices.ComTypes.IDataObject pDO, out System.Runtime.InteropServices.ComTypes.IDataObject ppDORet)
 {
     ppDORet = null;
     return(E_NOTIMPL);
 }