예제 #1
0
        private bool ShowDialogInternal(ref BrowseInfo bi)
        {
            bi.title       = title;
            bi.displayname = new string('\0', 260);
            bi.callback    = new BrowseCallBackProc(this.CallBack);
            bi.flags       = (int)flags;

            //Free any old pidls
            if (pidlReturned != IntPtr.Zero)
            {
                UnManagedMethods.SHMemFree(pidlReturned);
            }

            bool ret = (pidlReturned = UnManagedMethods.SHBrowseForFolder(ref bi)) != IntPtr.Zero;

            if (ret)
            {
                displayName = bi.displayname;
            }

            //Reset the handle
            handle = IntPtr.Zero;

            return(ret);
        }
예제 #2
0
        /// <summary>
        /// Shows the dialog
        /// </summary>
        /// <param name="owner">The window to use as the owner</param>
        /// <returns></returns>
        public bool ShowDialog(System.Windows.Forms.IWin32Window owner)
        {
            if (handle != IntPtr.Zero)
            {
                throw new InvalidOperationException();
            }

            BrowseInfo bi = new BrowseInfo();

            if (owner != null)
            {
                bi.hwndOwner = owner.Handle;
            }

            return(ShowDialogInternal(ref bi));
        }
예제 #3
0
 internal extern static System.IntPtr SHBrowseForFolder(ref BrowseInfo bi);