(CodeLib-Manager)
Registriert seit: 10. Jun 2002
4.648 Beiträge
Delphi XE Professional
|
Re: FileOpenDialog
14. Dez 2008, 20:21
Hallo
Sortieren kannst du mit ListView_SortItems().
Bei mir geht's so (Win XP):
Delphi-Quellcode:
uses
CommCtrl;
function SortFunc(Item1, Item2, Column: LPARAM):integer stdCall;
begin
Result := 1; // -1 für absteigende Sortierung
end;
procedure TForm1.OpenDialog1FolderChange(Sender: TObject);
const
FCIDM_SHVIEW_LARGEICON = $7029;
FCIDM_SHVIEW_SMALLICON = $702A;
FCIDM_SHVIEW_LIST = $702B;
FCIDM_SHVIEW_REPORT = $702C;
FCIDM_SHVIEW_THUMBNAIL = $702D;
FCIDM_SHVIEW_TILE = $702E;
var
NewStyle: DWORD;
hCommonDialog, hParentWindow, hFileListView : HWND;
begin
newStyle := FCIDM_SHVIEW_REPORT;
hCommonDialog := (Sender as TCommonDialog).Handle;
hParentWindow := FindWindowEx(GetParent(hCommonDialog),0, 'SHELLDLL_DefView',nil);
if hParentWindow <> 0 then
begin
hFileListView := FindWindowEx(hParentWindow, 0, 'SysListView32', nil);
if hFileListView <> 0 then
begin
SendMessage(hParentWindow, WM_COMMAND, NewStyle, 0);
ListView_SortItems(hFileListView, SortFunc, 0);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.Execute;
end;
Thomas
|
|
Zitat
|