SASL Posted January 5, 2021 Share Posted January 5, 2021 (edited) Hi, How can i identify the first file displayed in a folder after sorting? The function FileFindFirstFile returns invariably the first alphabetically sorted file and not the first displayed! Edited January 5, 2021 by SASL Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 5, 2021 Moderators Share Posted January 5, 2021 Why not show us your code and how you're sorting things? My crystal ball is in the shop "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
spudw2k Posted January 6, 2021 Share Posted January 6, 2021 FileFindFirstFile does not involve or interact with Windows Explorer. Sorting a Windows Explorer folder is independent from the FileFindFirstFile function, which instead looks at the file system directly. Also, per Microsoft Documentation for the API, "The order in which the search returns the files, such as alphabetical order, is not guaranteed, and is dependent on the file system. If the data must be sorted, the application must do the ordering after obtaining all the results. The order in which this function returns the file names is dependent on the file system type. With the NTFS file system and CDFS file systems, the names are usually returned in alphabetical order. With FAT file systems, the names are usually returned in the order the files were written to the disk, which may or may not be in alphabetical order. However, as stated previously, these behaviors are not guaranteed." If you want to retrieve the contents of a currently opened Windows Explorer view, you will need to use other methods. If you want to use FileFind(First/Next)File functions, you will need to collect all the files (and attributes) that you want to filter for and then sort it using an array for example. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
SASL Posted January 6, 2021 Author Share Posted January 6, 2021 Excellent explanation, dear Spudw2k. "If you want to retrieve the contents of a currently opened Windows Explorer view, you will need to use other methods." So, I need please one of these other methods. Cause making an Array or FileFindFirstFile do not show files in the order they are displayed after sorting. Link to comment Share on other sites More sharing options...
spudw2k Posted January 7, 2021 Share Posted January 7, 2021 (edited) I used to be able to interact with the SysListView32 control in windows explorer to retrieve the contents, but (I think since Vista+) I can't any longer. I think there may still be a way to retrieve it, but I don't have a working example right now. This thread may point in the right direction. Edited January 7, 2021 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
SASL Posted January 7, 2021 Author Share Posted January 7, 2021 I tried it on my win10-64 and the interface is working. Will study it and tell U. Thanks. Link to comment Share on other sites More sharing options...
LarsJ Posted January 7, 2021 Share Posted January 7, 2021 Note that there is a newer version of the code in this example. spudw2k 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now