Folder View
-
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
-
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
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
-
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
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