?
Solved

How to get Files/folders Sort order in Windows Explorer window in C#?

Posted on 2010-05-01
5
Medium Priority
?
810 Views
Last Modified: 2013-12-17
Hello,

Is there a way to get the sort order for files and folders in a windows explorer window?

P.S: i can get the Hwnd, but how to get the sort order?

Thanks.
0
Comment
Question by:YazArch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 25

Expert Comment

by:apeter
ID: 32504506
Interesting requirement, but looks like there is no api of help now.

Directory class members of no help.
0
 

Author Comment

by:YazArch
ID: 32543873
Thanks,

Interop.Shell32 has ShellFolderViewinterface which has ShellFolderViewClass which contains the SortColumns property, but how to retrieve that object from an Hwnd??
0
 

Accepted Solution

by:
YazArch earned 0 total points
ID: 32585786
Ok i figured it out:

//Shell32 is located in Interop.Shell32 assembly
 Shell32.ShellClass shell = new ShellClass();
   //Shellwindows is located in SHDocVw.dll under C:\windows
     ShellWindows shellWindows = (ShellWindows)shell.Windows();
         foreach (ShellBrowserWindow shellWindow in shellWindows)
            {                
     s = shellWindow.LocationURL; //this is the path

//This is the object that holds Explorer window information.
     ShellFolderView view = (ShellFolderView)shellWindow.Document;
         
                    MessageBox.Show(view.SortColumns);
}
}
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question