Using the Windows Explorer collation

Source: Internet
Author: User

For Windows Explorer Abc_1_def is to be queued to abc_10_def front of the

And the general sort of rules, all right, _10_ to the front.

Therefore, in order to use the habit, it is best to use the collation of the resource Manager, Windows has an API provides this rule:

The STRCMPLOGICALW function in Shlwapi.dll

Unfortunately, Delphi does not seem to introduce this function at the moment, at least I did not see it in XE5 's winapi.shlwapi, so I can only manually reference the

After referencing, using the same way as other sorts, use the ListView example:

functionSTRCMPLOGICALW (P1, P2:pwidechar): Integer;stdcall;External 'Shlwapi.dll';procedureTform1.listview1columnclick (sender:tobject; Column:tlistcolumn);beginListview1.alphasort;End;procedureTform1.listview1compare (sender:tobject; Item1, Item2:tlistitem;  Data:integer; varCompare:integer);beginCompare:=STRCMPLOGICALW (PChar (item1.caption), PChar (item2.caption));End;

Using the Windows Explorer collation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.