Esempio n. 1
0
 public static Object bindToObject(Object parentIShellFolder, IntPtr pIDL)
 {
     if (parentIShellFolder == null || pIDL == IntPtr.Zero)
     {
         return(null);
     }
     ShellApi.IShellFolder folder    = (ShellApi.IShellFolder)parentIShellFolder;
     ShellApi.IShellFolder newFolder = null;
     folder.BindToObject(pIDL, IntPtr.Zero, ref ShellApi.GUID_ISHELLFOLDER, out newFolder);
     return(newFolder);
 }
Esempio n. 2
0
 /// <summary>
 /// Creates an IShellFolder for a special folder
 /// </summary>
 /// <param name="desktopIShellFolder">The IShellFolder instance of the Desktop</param>
 /// <param name="pidl">The desktop relative pIDL of the special folder</param>
 /// <returns>The IShellFolder for a special folder</returns>
 public static Object initSpecialFolder(Object desktopIShellFolder, IntPtr pidl)
 {
     try
     {
         // get desktop instance
         ShellApi.IShellFolder desktop = (ShellApi.IShellFolder)desktopIShellFolder;
         // call BindToObject of the desktop
         ShellApi.IShellFolder specialFolder = null;
         desktop.BindToObject(pidl, IntPtr.Zero, ref ShellApi.GUID_ISHELLFOLDER, out specialFolder);
         return(specialFolder);
     }
     catch (System.ArgumentException)
     {
         return(0);
     }
 }