Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Folder View

Folder View

Scheduled Pinned Locked Moved C#
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rakesh_nits
    wrote on last edited by
    #1

    Hi All, Windows Explorer generally remembers the setting of each folder viewed.There is one entry in the HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags for each folder.how I can know which entry corresponds to which folder, programmatically.Thanks in advance. Rakesh -- modified at 2:03 Saturday 31st December, 2005

    D 1 Reply Last reply
    0
    • R rakesh_nits

      Hi All, Windows Explorer generally remembers the setting of each folder viewed.There is one entry in the HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags for each folder.how I can know which entry corresponds to which folder, programmatically.Thanks in advance. Rakesh -- modified at 2:03 Saturday 31st December, 2005

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      There is no documented relationship between which bag under ShellNoRoam belongs to which folder. You actually have to go through the Shell's Namespace interface on the ShellFolder you want to get this information. I hope you're familiar with the Win32 Shell API's. If not, Shell Basics[^]. From the MSDN Gospel: Objects that support IShellFolder are usually created by other Shell folder objects. To retrieve a folder's IShellFolder interface, you normally start by calling SHGetDesktopFolder. This function returns a pointer to the desktop's IShellFolder interface. You can then use its methods to retrieve an IShellFolder interface for a particular namespace folder. Note: IShellFolder methods only accept PIDLs that are relative to the folder. Some IShellFolder methods, such as IShellFolder::GetAttributesOf, only accept single-level PIDLs. In other words, the PIDL must contain only a single SHITEMID structure, plus the terminating NULL. When you enumerate the contents of a folder with IEnumIDList, you will receive PIDLs of this form. Other methods, such as IShellFolder::CompareIDs, accept multi-level PIDLs. These PIDLs can have multiple SHITEMID structures and identify objects one or more levels below the parent folder. Check the reference to be sure what type of PIDL can be accepted by a particular method. You can make a quick check to see if what you want to do can be done using the desktop.ini file in each folder by checking out this[^]. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      R 1 Reply Last reply
      0
      • D Dave Kreskowiak

        There is no documented relationship between which bag under ShellNoRoam belongs to which folder. You actually have to go through the Shell's Namespace interface on the ShellFolder you want to get this information. I hope you're familiar with the Win32 Shell API's. If not, Shell Basics[^]. From the MSDN Gospel: Objects that support IShellFolder are usually created by other Shell folder objects. To retrieve a folder's IShellFolder interface, you normally start by calling SHGetDesktopFolder. This function returns a pointer to the desktop's IShellFolder interface. You can then use its methods to retrieve an IShellFolder interface for a particular namespace folder. Note: IShellFolder methods only accept PIDLs that are relative to the folder. Some IShellFolder methods, such as IShellFolder::GetAttributesOf, only accept single-level PIDLs. In other words, the PIDL must contain only a single SHITEMID structure, plus the terminating NULL. When you enumerate the contents of a folder with IEnumIDList, you will receive PIDLs of this form. Other methods, such as IShellFolder::CompareIDs, accept multi-level PIDLs. These PIDLs can have multiple SHITEMID structures and identify objects one or more levels below the parent folder. Check the reference to be sure what type of PIDL can be accepted by a particular method. You can make a quick check to see if what you want to do can be done using the desktop.ini file in each folder by checking out this[^]. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        R Offline
        R Offline
        rakesh_nits
        wrote on last edited by
        #3

        Hi Dave, Thanks for your reply.Actually using the IShellFolder and IShellFolder2 interface was the first thing which i had tried.but i didn't have any success with them then i tried to get it through registry.Basically i want to know the sort order for a particular folder view if there is any.Hopefully by using IShellView or IShellFolder2 i can get some useful information.This is the code which i had tried. IntPtr newPidl = IntPtr.Zero ; IShellFolder ishFolder = null; IntPtr ppvOut = IntPtr.Zero; string path = @"C:\Documents and Settings\Administrator\Desktop\A"; if(Interop.SHGetDesktopFolder(ref ishFolder)==0) { // we have it: int cParsed = 0; int afItem = 0; ishFolder.ParseDisplayName( IntPtr.Zero, IntPtr.Zero, path, out cParsed, out newPidl, out afItem); IntPtr handle = IntPtr.Zero; WIN32_FIND_DATA data = new WIN32_FIND_DATA(); handle = Class2.FindFirstFile(path,out data); //here i am getting the error ishFolder.CreateViewObject(handle,ref IID_IShellFolder2,out ppvOut); ****************************************************** but i was not able to get any folder even IShellFolder interface itself from the CreateViewObject function.This is The error i got:: System.InvalidCastException: No such interface supported at TestApplication.IShellFolder.CreateViewObject(IntPtr hwndOwner, Guid& riid, IntPtr& ppvOut) How can i get IshellFolder2 or IShellView interface for any folder.what i am doing wrong here? Also thanks for the .ini link but i don't think it is going to solve my problem.Any ideas will be greatly appreciated.Thanks in Advance. Rakesh

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups