Q:

How to filter TShellListView items to a specific file extension? 

I'm working on a project in Delphi 7 that needs ShellListView1 so show .PNG or .JPG files only. 
How can I view only folders and specific file types (example: '.exe;.bat') ?  
I was told is a ShellListView1 component with masking but websites I try are offline. 

A:

You can write a handler for the OnAddFolder event, which fires whenever an item is going to be added to the list.  The following code allows to add only files with *.exe or *.bat extension to the list:
procedure TForm1.ShellListView1AddFolder(Sender: TObject;
  AFolder: TShellFolder; var CanAdd: Boolean);
var
  FileExt: string;
begin
  CanAdd := not AFolder. IsFolder;
  if CanAdd then
  begin
    FileExt := ExtractFileExt(AFolder. PathName);
    CanAdd := (FileExt = '.exe') or (FileExt = '.bat');
  end;
end;

