protected override bool RunDialog(IntPtr hwndOwner) { string root = Environment.GetFolderPath(RootFolder); using(IDLWrapper wrapper = new IDLWrapper(root)) { BROWSEINFO bi = new BROWSEINFO(); bi.hwndOwner = hwndOwner; bi.pidlRoot = wrapper.PIDL; bi.lpszTitle = Description; bi.ulFlags = BROWSEINFO.BIF_NEWDIALOGSTYLE | BROWSEINFO.BIF_SHAREABLE | BROWSEINFO.BIF_EDITBOX; if(!ShowNewFolderButton) { bi.ulFlags |= BROWSEINFO.BIF_NONEWFOLDERBUTTON; } using(IDLWrapper wrapper2 = new IDLWrapper(PInvoke.SHBrowseForFolder(ref bi))) { SelectedPath = wrapper2.Path; SelectedIDL = wrapper2.IDL; return !String.IsNullOrEmpty(SelectedPath); } } }
public static extern IntPtr SHBrowseForFolder(ref BROWSEINFO lpbi);