Ejemplo n.º 1
0
        internal void FireContentEnumerationComplete()
        {
            if (ViewEnumerationComplete != null)
            {

                //BeginInvoke(new MethodInvoker(
                //    delegate
                //    {
                        IntPtr n = WindowsAPI.FindWindowEx(this.Handle, IntPtr.Zero, "ExplorerBrowserControl", null);
                        IntPtr z = WindowsAPI.FindWindowEx(n, IntPtr.Zero, "DUIViewWndClassName", null);
                        IntPtr o = WindowsAPI.FindWindowEx(z, IntPtr.Zero, "DirectUIHWND", null);
                        IntPtr s1 = WindowsAPI.FindWindowEx(o, IntPtr.Zero, "CtrlNotifySink", null);
                        IntPtr s2 = WindowsAPI.FindWindowEx(o, s1, "CtrlNotifySink", null);
                        IntPtr s3 = WindowsAPI.FindWindowEx(o, s2, "CtrlNotifySink", null);
                        IntPtr k = WindowsAPI.FindWindowEx(s3, IntPtr.Zero, "SHELLDLL_DefView", null);
                        SysListViewHandle = WindowsAPI.FindWindowEx(k, IntPtr.Zero, "SysListView32", null);
                        if (SysListViewHandle == IntPtr.Zero)
                        {
                            SysListViewHandle = WindowsAPI.FindWindowEx(k, IntPtr.Zero, "DirectUIHWND", null);
                        }
                        IntPtr s4 = WindowsAPI.FindWindowEx(SysListViewHandle, IntPtr.Zero, "CtrlNotifySink", null);
                        IntPtr s5 = WindowsAPI.FindWindowEx(SysListViewHandle, s4, "CtrlNotifySink", null);
                        VScrollHandle = WindowsAPI.FindWindowEx(s5, IntPtr.Zero, "ScrollBar", null);
                        WindowsAPI.RECTW rscroll = new WindowsAPI.RECTW();
                        WindowsAPI.GetWindowRect(VScrollHandle, ref rscroll);
                        Guid iid = new Guid(ExplorerBrowserIIDGuid.IShellView);
                        IntPtr view = IntPtr.Zero;
                        HResult hr = this.explorerBrowserControl.GetCurrentView(ref iid, out view);
                        IShellView isv = (IShellView)Marshal.GetObjectForIUnknown(view);

                        AvailableVisibleColumns = AvailableColumns(isv, false);
                        SysListviewDT = (WindowsAPI.IDropTarget)isv;

                        Marshal.ReleaseComObject(isv);
                        WindowsAPI.RevokeDragDrop(SysListViewHandle);
                        ShellViewDragDrop DropTarget = new ShellViewDragDrop();
                        WindowsAPI.RegisterDragDrop(SysListViewHandle, DropTarget);
                        
                        GC.WaitForPendingFinalizers();
                        GC.Collect();
                    //}));
                
                ViewEnumerationComplete.Invoke(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor for the ShellView Drop Target
 /// </summary>
 /// <param name="oldTarget">The original IDropTarget hooked from the IExplorerBrowser interface</param>
 public ShellViewDragDrop(WindowsAPI.IDropTarget oldTarget)
 {
     _oldDropTarget = oldTarget;
 }