1
2 unit Unit1;
3
4 interface
5
6 uses
7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8 Dialogs, ShlObj, StdCtrls, FileCtrl;
9
10 type
11 TForm1 = class(TForm)
12 Button1: TButton;
13 Edit1: TEdit;
14 FileListBox1: TFileListBox;
15 procedure Button1Click(Sender: TObject);
16 private
17 { Private declarations }
18 public
19 { Public declarations }
20 end;
21
22 var
23 Form1: TForm1;
24
25 implementation
26
27 {$R *.dfm}
28
29
30 procedure TForm1.Button1Click(Sender: TObject);
31 var
32 pItem: PItemIDList;
33 Path: array [0..MAX_PATH-1] of char;
34 begin
35 {get location of destop folder}
36 if SHGetSpecialFolderLocation(Handle, CSIDL_DESKTOP , pItem) = NOERROR then
37 begin
38 SHGetPathFromIDList(pItem, Path);
39 FileListBox1.Directory:=path; // view files in the folder
40 caption:=path;
41 end;
42 end;
43
44
45 { Here is a list of Folder locations
46
47 CSIDL_STARTMENU Start menu Folder location
48 CSIDL_HISTORY History folder location
49 CSIDL_INTERNET_CACHE Internet cache folder location
50 CSIDL_COMMON_FAVORITES Favorates folder location
51 CSIDL_PRINTHOOD Print Hood Folder Location
52 CSIDL_COMMON_DESKTOPDIRECTORY Common Desktop folder location
53 CSIDL_DESKTOP Desktop folder location
54 CSIDL_RECENT Recent Folder Location
55 CSIDL_PERSONAL My Documents folder location
56 }
57
58
59 end.
|