Solved it. There is nothing within .Net to do this and I can't find that MS
has issued a formal definition of their rules, but the old StrCmpLogicalW
function will do the comparison and appears to produce the same sequence as
Explorer.
<System.Runtime .InteropService s.DllImport("sh lwapi.dll",
charset:=Runtim e.InteropServic es.CharSet.Unic ode)_
Public Shared Function StrCmpLogicalW( ByVal strA As String, ByVal strB As
String) As Int32
End Function
and then, within the comparer:
compareResult = StrCmpLogicalW( X, Y.)
The charset attribute is needed: even though it's a W funtion it does not
default to Unicode.
"James Hahn" <jh***@yahoo.co mwrote in message
news:ed******** ******@TK2MSFTN GP06.phx.gbl...
>I have a ListView that displays files selected from various folders using a
user-specified selection rule. I want to sort the files in various ways
and have implemented a sorter class to do it, for instance to sort the file
date as a date and not as text.
But the filenames are not listed in the same sequence as in Explorer,
which is some sort of 'Numeric-modified alpha' sequence. Is there a
comparer that will return the correct sort sequence for a filename, or is
there a definition of the rules used in an Explorer sort so I could write
my own comparer?