string GetSpecialDirectory(CSIDL specialFolder)
        {
            var path = new StringBuilder(260);

            SHGetSpecialFolderPath(IntPtr.Zero, path, (int)specialFolder, false);
            return(path.ToString());
        }
Esempio n. 2
0
        public static string GetEnvironmentPath(CSIDL target)
        {
            var path = new StringBuilder(260);

            NativeMethods.SHGetSpecialFolderPath(IntPtr.Zero, path, (int)target, false);
            return(path.ToString());
        }
Esempio n. 3
0
        private static string GetDirectory(CSIDL folder)
        {
            StringBuilder path = new StringBuilder(260);

            SHGetSpecialFolderPath(IntPtr.Zero, path, folder, false);
            return(path.ToString());
        }
Esempio n. 4
0
 public static extern Int32 SHGetFolderLocation(
     IntPtr hwndOwner,
     CSIDL nFolder,
     IntPtr hToken,
     UInt32 dwReserved,
     out IntPtr ppidl
     );
Esempio n. 5
0
        public static string GetFolderPath(CSIDL specialFolder)
        {
            StringBuilder resultPath = new StringBuilder(255);

            SHGetSpecialFolderPath((IntPtr)0, resultPath, (int)specialFolder, true);
            return(resultPath.ToString());
        }
Esempio n. 6
0
        /*
         *      [DllImport("shell32.dll")]
         *      public static extern int SHGetIDListFromObject([MarshalAs(UnmanagedType.IUnknown)] object punk, out IntPtr ppidl);
         */

        #region Register Functions


        /// <summary>
        /// Register a form handle
        /// This form will receive a WM_SHNOTIFY when a notification occures
        ///
        /// !!!!! Add this code to your registered form : !!!!!
        /// protected override void WndProc(ref Message m)
        /// {
        ///		switch(m.Msg)
        ///		{
        ///			case (int) ShellNotifications.WM_SHNOTIFY:
        ///			if(Notifications.NotificationReceipt(m.WParam, m.LParam))
        ///				NewOperation((NotifyInfos) Notifications.NotificationsReceived[Notifications.NotificationsReceived.Count-1]);
        ///			break;
        ///		}
        ///		base.WndProc(ref m);
        /// }
        /// </summary>
        /// <param name="hWnd"></param>
        /// <param name="item">ID of the special folder</param>
        /// <param name="Recursively">Look recursively at modifications</param>
        /// <returns></returns>
        public ulong RegisterChangeNotify(IntPtr hWnd, CSIDL item, bool Recursively)
        {
            if (notifyid != 0)
            {
                return(0);
            }
            SHChangeNotifyEntry changeentry = new SHChangeNotifyEntry()
            {
                pIdl = GetPidlFromFolderID(hWnd, item), Recursively = Recursively
            };

            SHChangeNotifyEntry[] changenetrys = new SHChangeNotifyEntry[1] {
                changeentry
            };
            //changenetrys[0] = changeentry;
            notifyid = SHChangeNotifyRegister(
                hWnd,
                //SHCNF.SHCNF_TYPE | SHCNF.SHCNF_IDLIST,
                (SHCNRF)0x00FF | (SHCNRF)0x0000 | SHCNRF.NewDelivery,
                SHCNE.SHCNE_ALLEVENTS | SHCNE.SHCNE_INTERRUPT,
                WM_SHNOTIFY,
                1,
                changenetrys);
            return(notifyid);
        }
Esempio n. 7
0
        public static string GetSpecialFolderPath(CSIDL id)
        {
            string path = string.Empty;

            SHGetSpecialFolderPath((IntPtr)0, ref path, id, false);
            return(path);
        }
Esempio n. 8
0
        public static unsafe string SHGetFolderPath(CSIDL folder, IntPtr hToken = default(IntPtr), SHGetFolderPathFlags flags = SHGetFolderPathFlags.SHGFP_TYPE_CURRENT)
        {
            char* pszPath = stackalloc char[Kernel32.MAX_PATH + 1];
#pragma warning disable CS0618 // Type or member is obsolete
            SHGetFolderPath(IntPtr.Zero, folder, hToken, flags, pszPath).ThrowOnFailure();
#pragma warning restore CS0618 // Type or member is obsolete

            return new string(pszPath);
        }
        private static KnownFolder CreateFolder(CSIDL csidl, string name)
        {
            var path = new StringBuilder(512);

            if (Shell32.SHGetFolderPath(IntPtr.Zero, csidl, IntPtr.Zero, 0, path) == HResult.S_OK)
            {
                return(new KnownFolder(csidl, name, path.ToString()));
            }
            return(new KnownFolder(csidl, name, string.Empty));
        }
Esempio n. 10
0
        public static unsafe string SHGetFolderPath(CSIDL folder, IntPtr hToken = default(IntPtr), SHGetFolderPathFlags flags = SHGetFolderPathFlags.SHGFP_TYPE_CURRENT)
        {
            char *pszPath = stackalloc char[Kernel32.MAX_PATH + 1];

#pragma warning disable CS0618 // Type or member is obsolete
            SHGetFolderPath(IntPtr.Zero, folder, hToken, flags, pszPath).ThrowOnFailure();
#pragma warning restore CS0618 // Type or member is obsolete

            return(new string(pszPath));
        }
Esempio n. 11
0
#pragma warning disable RS0027 // Public API with optional parameter(s) should have the most parameters amongst its public overloads.
        public static unsafe string SHGetFolderPath(CSIDL folder, IntPtr hToken = default(IntPtr), SHGetFolderPathFlags flags = SHGetFolderPathFlags.SHGFP_TYPE_CURRENT)
#pragma warning restore RS0027 // Public API with optional parameter(s) should have the most parameters amongst its public overloads.
        {
            char *pszPath = stackalloc char[Kernel32.MAX_PATH + 1];

#pragma warning disable CS0618 // Type or member is obsolete
            SHGetFolderPath(IntPtr.Zero, folder, hToken, flags, pszPath).ThrowOnFailure();
#pragma warning restore CS0618 // Type or member is obsolete

            return(new string(pszPath));
        }
Esempio n. 12
0
        /// <summary>
        /// 該当フォルダのpIdlを取得する
        /// </summary>
        /// <param name="hWnd"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        private static IntPtr GetPidlFromFolderID(IntPtr hWnd, CSIDL id)
        {
            IntPtr pIdl = IntPtr.Zero;
            SHGetFolderLocationReturnValues res = (SHGetFolderLocationReturnValues)
                                                  SHGetSpecialFolderLocation(
                hWnd,
                id,
                out pIdl);

            return(pIdl);
        }
Esempio n. 13
0
        void AddFolder(string name, CSIDL csidl)
        {
            KnownFolder folder = CreateFolder(csidl, name);

            m_NameIndex.Add(folder.Name, folder);

            if (folder.ParsingName != string.Empty)
            {
                m_PathIndex.Add(folder.ParsingName, folder);
            }
        }
        private void AddFolder(string name, CSIDL csidl)
        {
            var folder = CreateFolder(csidl, name);

            _mNameIndex.Add(folder.Name, folder);

            if (folder.ParsingName != string.Empty)
            {
                _mPathIndex.Add(folder.ParsingName, folder);
            }
        }
Esempio n. 15
0
 /*****************************************************************************
 *
 * GetSpecialFolder
 *
 * Create an IShellFolder for the specified special folder.
 *
 * It is the responsibility of the caller to Release() the
 * IShellFolder that is returned.
 *
 *****************************************************************************/
 static IShellFolder GetSpecialFolder(HWND hwnd, CSIDL idFolder)
 {
     if (SHGetFolderLocation(hwnd, idFolder, ppidl: out var pidl).Succeeded)
     {
         using (pidl)
             if (g_psfDesktop.BindToObject(pidl, default, typeof(IShellFolder).GUID, out var ppv).Succeeded)
             {
                 return((IShellFolder)ppv);
             }
     }
     return(null);
 }
 private static IEnumerable <string> GetLnkFilesSafe(CSIDL directory, SearchOption option)
 {
     try
     {
         return(Directory.GetFiles(WindowsTools.GetEnvironmentPath(directory), "*.lnk", option));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         Debug.Fail(ex.ToString());
     }
     return(Enumerable.Empty <string>());
 }
Esempio n. 17
0
        public static string GetSpecialFolderLocation(CSIDL folderCode)
        {
            IntPtr pidl = Marshal.AllocHGlobal(1024);

            SHGetSpecialFolderLocation(pidl, folderCode, ref pidl);
            System.Text.StringBuilder path = new System.Text.StringBuilder(260);
            bool result = SHGetPathFromIDListW(pidl, path);

            Marshal.FreeHGlobal(pidl);
            if (result == false)
            {
                throw new ArgumentException();
            }
            return(path.ToString().TrimEnd(char.MinValue));
        }
Esempio n. 18
0
    public static string SHGetFolderPath(CSIDL folder)
    {
        string result = null;

        System.IntPtr p = Marshal.AllocHGlobal(2 * (MAX_PATH + 1));
        try {
            if (0 == Win32.SHGetFolderPath(System.IntPtr.Zero, (int)folder, 0, 0, p))
            {
                result = Marshal.PtrToStringUni(p);
            }
        } finally {
            Marshal.FreeHGlobal(p);
        }
        return(result);
    }
Esempio n. 19
0
        public static string GetSpecialFolder(CSIDL nFolder)
        {
            IntPtr ptrAppData = IntPtr.Zero;

            SHGetSpecialFolderLocation(IntPtr.Zero, nFolder, ref ptrAppData);
            string        dirAppData = "";
            StringBuilder sbAppData  = new StringBuilder(MAX_PATH);

            if (true == SHGetPathFromIDListW(ptrAppData, sbAppData))
            {
                dirAppData = sbAppData.ToString();
            }

            sbAppData = null;
            Marshal.FreeCoTaskMem(ptrAppData);
            return(dirAppData);
        }
Esempio n. 20
0
        /// <summary>
        /// シェルのチェンジイベント受付を登録する
        /// </summary>
        /// <param name="hWnd"></param>
        /// <param name="folderID"></param>
        /// <param name="recursively"></param>
        /// <returns></returns>
        public ulong RegisterChangeNotify(IntPtr hWnd, CSIDL folderID, bool recursively)
        {
            if (notifyid != 0)
            {
                return(0);
            }
            SHChangeNotifyEntry changeentry = new SHChangeNotifyEntry();

            changeentry.pIdl        = GetPidlFromFolderID(hWnd, folderID);
            changeentry.Recursively = recursively;
            notifyid = SHChangeNotifyRegister(
                hWnd,
                SHCNF.SHCNF_TYPE | SHCNF.SHCNF_IDLIST,
                SHCNE.SHCNE_ALLEVENTS | SHCNE.SHCNE_INTERRUPT,
                (int)WM.WM_SHNOTIFY,
                1,
                ref changeentry);
            return(notifyid);
        }
Esempio n. 21
0
        /// <summary>
        /// Register a form handle
        /// This form will receive a WM_SHNOTIFY when a notification occures
        ///
        /// !!!!! Add this code to your registered form : !!!!!
        /// protected override void WndProc(ref Message m)
        /// {
        ///		switch(m.Msg)
        ///		{
        ///			case (int) ShellNotifications.WM_SHNOTIFY:
        ///			if(Notifications.NotificationReceipt(m.WParam, m.LParam))
        ///				NewOperation((NotifyInfos) Notifications.NotificationsReceived[Notifications.NotificationsReceived.Count-1]);
        ///			break;
        ///		}
        ///		base.WndProc(ref m);
        /// }
        /// </summary>
        /// <param name="hWnd"></param>
        /// <param name="FolderID">Root folder of the 'spy' (CSIDL_DESKTOP vor example)</param>
        /// <param name="Recursively">Look recursively at modifications</param>
        /// <returns></returns>
        public ulong RegisterChangeNotify(IntPtr hWnd, CSIDL FolderID, bool Recursively)
        {
            if (notifyid != 0)
            {
                return(0);
            }
            SHChangeNotifyEntry changeentry = new SHChangeNotifyEntry();
            IntPtr ppidl = IntPtr.Zero;

            ppidl                   = GetPidlFromFolderID(hWnd, FolderID);
            changeentry.pIdl        = ppidl;
            changeentry.Recursively = Recursively;
            notifyid                = SHChangeNotifyRegister(
                hWnd,
                SHCNRF.InterruptLevel | SHCNRF.ShellLevel,
                SHCNE.SHCNE_ALLEVENTS,
                WM_SHNOTIFY,
                1,
                ref changeentry);
            return(notifyid);
        }
        /// <summary>
        /// Register a form handle
        /// This form will receive a WM_SHNOTIFY when a notification occures
        ///
        /// </summary>
        /// <param name="hWnd"></param>
        /// <param name="folderID">Root folder of the 'spy' (CSIDL_DESKTOP vor example)</param>
        /// <param name="recursively">Look recursively at modifications</param>
        /// <returns></returns>
        public ulong RegisterChangeNotify(IntPtr hWnd, CSIDL folderID, bool recursively)
        {
            if (_notifyid != 0)
            {
                return(0);
            }

            SHChangeNotifyEntry changeentry = new SHChangeNotifyEntry();

            changeentry.pIdl        = GetPidlFromFolderID(hWnd, folderID);
            changeentry.Recursively = recursively;

            _notifyid = SHChangeNotifyRegister(
                hWnd,
                SHCNF.SHCNF_TYPE | SHCNF.SHCNF_IDLIST,
                //SHCNE.SHCNE_ALLEVENTS | SHCNE.SHCNE_INTERRUPT,
                SHCNE.SHCNE_MEDIAINSERTED | SHCNE.SHCNE_MEDIAREMOVED,
                WmShnotify,
                1,
                ref changeentry);
            return(_notifyid);
        }
Esempio n. 23
0
        /// <summary>
        /// Register a form handle
        /// This form will receive a WM_SHNOTIFY when a notification occures
        ///
        /// !!!!! Add this code to your registered form : !!!!!
        /// protected override void WndProc(ref Message m)
        /// {
        ///		switch(m.Msg)
        ///		{
        ///			case (int) ShellNotifications.WM_SHNOTIFY:
        ///			if(Notifications.NotificationReceipt(m.WParam, m.LParam))
        ///				NewOperation((NotifyInfos) Notifications.NotificationsReceived[Notifications.NotificationsReceived.Count-1]);
        ///			break;
        ///		}
        ///		base.WndProc(ref m);
        /// }
        /// </summary>
        /// <param name="hWnd"></param>
        /// <param name="item">ID of the special folder</param>
        /// <param name="recursively">Look recursively at modifications</param>
        /// <returns></returns>
        public ulong RegisterChangeNotify(IntPtr hWnd, CSIDL item, bool recursively)
        {
            if (this.notifyid != 0)
            {
                return(0);
            }

            SHChangeNotifyEntry changeentry = new SHChangeNotifyEntry()
            {
                pIdl = GetPidlFromFolderID(hWnd, item), Recursively = recursively
            };

            SHChangeNotifyEntry[] changenetrys = new SHChangeNotifyEntry[1] {
                changeentry
            };
            this.notifyid = SHChangeNotifyRegister(
                hWnd,
                SHCNRF.ShellLevel | SHCNRF.InterruptLevel | SHCNRF.NewDelivery,
                SHCNE.SHCNE_ALLEVENTS | SHCNE.SHCNE_INTERRUPT,
                WM_SHNOTIFY,
                1,
                changenetrys);
            return(this.notifyid);
        }
Esempio n. 24
0
 public static extern unsafe HResult SHGetFolderLocation(
     IntPtr hwndOwner,
     CSIDL nFolder,
     IntPtr hToken,
     int dwReserved,
     out ITEMIDLIST *pidl);
Esempio n. 25
0
 public static extern unsafe HResult SHGetFolderPath(
     IntPtr hwndOwner,
     CSIDL nFolder,
     IntPtr hToken,
     SHGetFolderPathFlags dwFlags,
     [Friendly(FriendlyFlags.Array)] char *pszPath);
 public static extern Int32 SHGetFolderPath(IntPtr hwndOwner, CSIDL nFolder, IntPtr hToken, SHGFP dwFlags, StringBuilder pszPath);
Esempio n. 27
0
 public static string GetSpecialFolderPath(CSIDL id)
 {
     string path = string.Empty;
     SHGetSpecialFolderPath((IntPtr)0, ref path, id, false);
     return path;
 }
Esempio n. 28
0
 public PathIndexEntry(string name, CSIDL csidl)
 {
     Name  = name;
     Csidl = csidl;
 }
Esempio n. 29
0
 public static extern Int32 SHGetSpecialFolderLocation(IntPtr hwndOwner, CSIDL nFolder, ref IntPtr ppidl);
Esempio n. 30
0
    /// <summary>
    /// Register a form handle
    /// This form will receive a WM_SHNOTIFY when a notification occures
    /// 
    /// </summary>
    /// <param name="hWnd"></param>
    /// <param name="folderID">Root folder of the 'spy' (CSIDL_DESKTOP vor example)</param>
    /// <param name="recursively">Look recursively at modifications</param>
    /// <returns></returns>
    public ulong RegisterChangeNotify(IntPtr hWnd, CSIDL folderID, bool recursively)
    {
      if (_notifyid != 0)
      {
        return (0);
      }
      
      SHChangeNotifyEntry changeentry = new SHChangeNotifyEntry();
      changeentry.pIdl = GetPidlFromFolderID(hWnd, folderID);
      changeentry.Recursively = recursively;

      _notifyid = SHChangeNotifyRegister(
        hWnd,
        SHCNF.SHCNF_TYPE | SHCNF.SHCNF_IDLIST,
        //SHCNE.SHCNE_ALLEVENTS | SHCNE.SHCNE_INTERRUPT,
        SHCNE.SHCNE_MEDIAINSERTED | SHCNE.SHCNE_MEDIAREMOVED,
        WmShnotify,
        1,
        ref changeentry);
      return (_notifyid);
    }
 private static extern uint SHGetSpecialFolderLocation(
     IntPtr hWnd,
     CSIDL nFolder,
     out IntPtr Pidl);
        /// <summary>
        /// Force explorer window to update a location
        /// </summary>
        /// <param name="specialItemID"></param>
        internal static void RefreshSpecialItem( CSIDL specialItemID )
        {
            try
            {

                IntPtr pidl = IntPtr.Zero;

                if ( SHGetSpecialFolderLocation( IntPtr.Zero, specialItemID, ref pidl ) == 0 )
                    SHChangeNotify( HChangeNotifyEventID.SHCNE_ALLEVENTS, HChangeNotifyFlags.SHCNF_IDLIST | HChangeNotifyFlags.SHCNF_FLUSH, pidl, IntPtr.Zero );

            }
            catch ( Exception )
            {
            }
        }
Esempio n. 33
0
 public static extern int SHGetSpecialFolderLocation( IntPtr hwndOwner, CSIDL nFolder, ref IntPtr ppidl );
Esempio n. 34
0
 //*
 //* Displays a dialog that allows the user select a file, starting from a specified CSIDL.
 //*
 public string BrowseForFiles( CSIDL StartLocation)
 {
     SHGetSpecialFolderLocation(stcBrowseInfo.hOwner, (int)StartLocation, ref stcBrowseInfo.pidlRoot);
     stcBrowseInfo.ulFlags = BIF_BROWSEINCLUDEFILES;
     return DoBrowse("");
 }
Esempio n. 35
0
        /// <summary>
        /// Gets the specified special folder. This includes folders not normally available within Environment.SpecialFolders.
        /// </summary>
        /// <param name="folder">The folder to get.</param>
        /// <returns>The file path.</returns>
        public static string GetSpecialFolder(CSIDL folder)
        {
            StringBuilder path = new StringBuilder(" ", 500);

            int ret = Win32Services.SHGetSpecialFolderPath(IntPtr.Zero, path, (int)folder, false);

            if (ret == 0)
            {
                Debug.WriteLine(Marshal.GetLastWin32Error());
                return String.Empty;
            }
            else
            {
                return path.ToString();
            }
        }
Esempio n. 36
0
 public static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, StringBuilder lpszPath, CSIDL nFolder, bool fCreate);
        /*
		[DllImport("shell32.dll")]
		public static extern int SHGetIDListFromObject([MarshalAs(UnmanagedType.IUnknown)] object punk, out IntPtr ppidl);
		*/

        #region Register Functions


        /// <summary>
        /// Register a form handle
        /// This form will receive a WM_SHNOTIFY when a notification occures
        /// 
        /// !!!!! Add this code to your registered form : !!!!!
        /// protected override void WndProc(ref Message m)
        /// {
        ///		switch(m.Msg)
        ///		{
        ///			case (int) ShellNotifications.WM_SHNOTIFY:
        ///			if(Notifications.NotificationReceipt(m.WParam, m.LParam))
        ///				NewOperation((NotifyInfos) Notifications.NotificationsReceived[Notifications.NotificationsReceived.Count-1]);
        ///			break;
        ///		}
        ///		base.WndProc(ref m);
        /// }
        /// </summary>
        /// <param name="hWnd"></param>
        /// <param name="item">ID of the special folder</param>
        /// <param name="Recursively">Look recursively at modifications</param>
        /// <returns></returns>
        public ulong RegisterChangeNotify(IntPtr hWnd, CSIDL item, bool Recursively)
        {
            if (notifyid != 0) return (0);
            SHChangeNotifyEntry changeentry = new SHChangeNotifyEntry() { pIdl = GetPidlFromFolderID(hWnd, item), Recursively = Recursively };
            SHChangeNotifyEntry[] changenetrys = new SHChangeNotifyEntry[1] { changeentry };
            //changenetrys[0] = changeentry;
            notifyid = SHChangeNotifyRegister(
                hWnd,
        //SHCNF.SHCNF_TYPE | SHCNF.SHCNF_IDLIST,
        (SHCNRF)0x00FF | (SHCNRF)0x0000 | SHCNRF.NewDelivery,
        SHCNE.SHCNE_ALLEVENTS | SHCNE.SHCNE_INTERRUPT,
                WM_SHNOTIFY,
                1,
                changenetrys);
            return (notifyid);
        }
Esempio n. 38
0
 public static extern unsafe HResult SHGetFolderPath(
     IntPtr hwndOwner,
     CSIDL nFolder,
     IntPtr hToken,
     SHGetFolderPathFlags dwFlags,
     [Friendly(FriendlyFlags.Array)] char* pszPath);
        ///// <summary>
        ///// Get the path from a Pidl value
        ///// </summary>
        ///// <param name="Pidl">Pidl of the path</param>
        ///// <returns>Path</returns>
        //public static string GetPathFromPidl(IntPtr Pidl) {
        //	string Path = new String('\0', MAX_PATH);
        //	return (SHGetPathFromIDList(Pidl, Path) ? Path.ToString().TrimEnd('\0') : "");
        //}

        ///// <summary>
        ///// Do not work
        ///// If someone has a solution please tell me ([email protected])
        ///// </summary>
        ///// <param name="Pidl"></param>
        ///// <returns></returns>
        //public static string GetDisplayNameFromPidl(IntPtr Pidl) {
        //	SHFILEINFO fileinfo = new SHFILEINFO(true);
        //	SHGetFileInfoA(
        //		(uint)Pidl,
        //		0,
        //		out fileinfo,
        //		(uint)Marshal.SizeOf(fileinfo),
        //		SHGFI.SHGFI_PIDL | SHGFI.SHGFI_DISPLAYNAME);
        //	return (fileinfo.szDisplayName);
        //}



        /// <summary>
        /// Get the Pidl from a special folder ID
        /// </summary>
        /// <param name="hWnd">Handle of the window</param>
        /// <param name="Id">ID of the special folder</param>
        /// <returns>Pidl of the special folder</returns>
        public static IntPtr GetPidlFromFolderID(IntPtr hWnd, CSIDL Id)
        {
            IntPtr pIdl = IntPtr.Zero;
            SHGetFolderLocationReturnValues res = (SHGetFolderLocationReturnValues)
                SHGetSpecialFolderLocation(
                hWnd,
                Id,
                out pIdl);
            return (pIdl);
        }
Esempio n. 40
0
	   public static string GetFolderPath(CSIDL specialFolder) {
		  StringBuilder resultPath = new StringBuilder(255);
		  SHGetSpecialFolderPath((IntPtr)0, resultPath, (int)specialFolder, true);
		  return resultPath.ToString();
	   }
Esempio n. 41
0
 private static string GetDirectory(CSIDL folder)
 {
     StringBuilder path = new StringBuilder(260);
     SHGetSpecialFolderPath(IntPtr.Zero, path, folder, false);
     return path.ToString();
 }
Esempio n. 42
0
 private static extern uint SHGetSpecialFolderLocation(
     IntPtr hWnd,
     CSIDL nFolder,
     out IntPtr Pidl);
Esempio n. 43
0
 public KnownFolder(CSIDL csidl, string name, string parsingName)
 {
     m_Csidl       = csidl;
     m_Name        = name;
     m_ParsingName = parsingName;
 }
Esempio n. 44
0
 //*
 //* Displays a dialog that allows the user select a folder, starting from a specified CSIDL
 //*
 public string BrowseForFolder( CSIDL StartLocation)
 {
     SHGetSpecialFolderLocation(stcBrowseInfo.hOwner, (int)StartLocation, ref stcBrowseInfo.pidlRoot);
     stcBrowseInfo.ulFlags = BIF_RETURNONLYFSDIRS;
     return DoBrowse("");
 }
Esempio n. 45
0
 public static extern int SHGetSpecialFolderLocation(IntPtr handle, CSIDL nFolder, out IntPtr ppidl);
Esempio n. 46
0
    public static string GetSpecialFolder(CSIDL nFolder)
    {
      IntPtr ptrAppData = IntPtr.Zero;
      SHGetSpecialFolderLocation(IntPtr.Zero, nFolder, ref ptrAppData);
      string dirAppData = "";
      StringBuilder sbAppData = new StringBuilder(MAX_PATH);

      if (true == SHGetPathFromIDListW(ptrAppData, sbAppData))
      {
        dirAppData = sbAppData.ToString();
      }

      sbAppData = null;
      Marshal.FreeCoTaskMem(ptrAppData);
      return dirAppData;
    }
 public static extern Int32 SHGetSpecialFolderLocation(IntPtr hwndOwner, CSIDL nFolder, out IntPtr ppidl);
Esempio n. 48
0
 public static extern int SHGetSpecialFolderPath(
     IntPtr hwndOwner, ref string lpszPath, CSIDL nFolder, bool fCreate);
Esempio n. 49
0
 public static extern unsafe HResult SHGetFolderLocation(
     IntPtr hwndOwner,
     CSIDL nFolder,
     IntPtr hToken,
     int dwReserved,
     out ITEMIDLIST* pidl);
Esempio n. 50
0
 public static extern int SHGetSpecialFolderLocation(IntPtr handle, CSIDL nFolder, out IntPtr ppidl);
Esempio n. 51
0
 public static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpszPath, CSIDL nFolder, [MarshalAs(UnmanagedType.Bool)] bool fCreate);
Esempio n. 52
0
		public static extern int SHGetFolderLocation(IntPtr hwndOwner, CSIDL nFolder, IntPtr hToken, uint dwReserved, out IntPtr ppidl);
Esempio n. 53
0
 public static extern int SHGetSpecialFolderLocation(IntPtr hWnd, CSIDL nFolder, out IntPtr Pidl);
Esempio n. 54
0
 public static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, StringBuilder lpszPath, CSIDL nFolder, bool fCreate);