Esempio n. 1
0
        /// <summary>
        ///     Returns an <see cref="System.Runtime.InteropServices.ComTypes.IDataObject" /> representing the
        ///     item. This object is used in drag and drop operations.
        /// </summary>
        public IDataObject GetIDataObject()
        {
            var result = ComInterface.BindToHandler(IntPtr.Zero,
                                                    BHID.SFUIObject, typeof(IDataObject).GUID);

            return((IDataObject)Marshal.GetTypedObjectForIUnknown(result,
                                                                  typeof(IDataObject)));
        }
Esempio n. 2
0
        /// <summary>
        ///     Returns an <see cref="IShellFolder" /> representing the
        ///     item.
        /// </summary>
        public IShellFolder GetIShellFolder()
        {
            var result = ComInterface.BindToHandler(IntPtr.Zero,
                                                    BHID.SFObject, typeof(IShellFolder).GUID);

            return((IShellFolder)Marshal.GetTypedObjectForIUnknown(result,
                                                                   typeof(IShellFolder)));
        }
Esempio n. 3
0
        /// <summary>
        /// Returns an <see cref="IShellFolder"/> representing the
        /// item.
        /// </summary>
        public IShellFolder GetIShellFolder()
        {
            IntPtr res;

            try {
                ComInterface.BindToHandler(IntPtr.Zero, BHID.SFObject, typeof(IShellFolder).GUID, out res); //HResult result =
                var iShellFolder = (IShellFolder)Marshal.GetTypedObjectForIUnknown(res, typeof(IShellFolder));
                return(iShellFolder);
            } catch {
                return(null);
            }
        }