unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ShellCtrls, sSkinManager, sSkinProvider, StdCtrls, sButton,
sLabel, FileCtrl;
const
shlwapi = '
SHLWAPI.DLL';
function PathMatchSpec(pszFileParam, pszSpec: PAnsiChar): BOOL;
stdcall external shlwapi
name '
PathMatchSpecA';
type
TForm3 =
class(TForm)
sSkinProvider1: TsSkinProvider;
sSkinManager3: TsSkinManager;
ShellTreeView1: TShellTreeView;
sLabel1: TsLabel;
sButton1: TsButton;
FilterComboBox1: TFilterComboBox;
procedure FilterComboBox1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ShellTreeView1AddFolder(Sender: TObject; AFolder: TShellFolder;
var CanAdd: Boolean);
procedure sButton1Click(Sender: TObject);
procedure ShellTreeView1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
WantMerge: Boolean;
end;
var
Form3: TForm3;
implementation
uses Unit1;
{$R *.dfm}
function PathMatchSpecs(
const fn: TFileName;
const mask:
string): Boolean;
var
s: TStrings;
ok: Boolean;
i: Integer;
begin
ok := False;
with TStringList.Create
do
try
Delimiter := '
;';
DelimitedText := mask;
for i := 0
to Pred(Count)
do
begin
ok := ok
or PathMatchSpec(PChar(fn), PChar(Strings[i]));
if ok
then
Break;
end;
finally
Free;
end;
Result := ok;
end;
procedure TForm3.ShellTreeView1Click(Sender: TObject);
begin
sLabel1.Caption := '
Aktueller Pfad: ' + ShellTreeView1.Path;
end;
procedure TForm3.sButton1Click(Sender: TObject);
begin
Form1.Edit2.Text := ShellTreeView1.Path;
Close;
end;
procedure TForm3.ShellTreeView1AddFolder(Sender: TObject; AFolder: TShellFolder;
var CanAdd: Boolean);
begin
CanAdd := AFolder.IsFolder
or
PathMatchSpecs(AFolder.DisplayName, FilterComboBox1.Mask);
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
FilterComboBox1.Filter := '
Alle Dateien (*.*)|*.*|Textdateien (*.txt)|*.txt';
ShellTreeView1.ObjectTypes := [otNonFolders]
+ ShellTreeView1.ObjectTypes;
end;
procedure TForm3.FilterComboBox1Change(Sender: TObject);
begin
ShellTreeView1.Refresh(ShellTreeView1.Items.GetFirstNode);
end;
end.