改变文件夹图标
2006-02-04 13:55:30 来源:WEB开发网说白修改文件里的隐藏文件desktop.ini
下面是源代码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
PRocedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
iniFile : TStrings ;
begin
CreateDir('C:\YourFolder') ;
iniFile := TStringList.Create;
with iniFile do
begin
Add('[.ShellClassInfo]') ;
Add('IconFile = ' + GetEnvironmentVariable('Windir')
+ '\system32\SHELL32.DLL') ;
Add('IconIndex = 38') ;
Add('InfoTip = This is folder with icon') ;
SaveToFile('C:\YourFolder\Desktop.ini');
end;
SysUtils.FileSetAttr('C:\YourFolder', SysUtils.faReadOnly) ;
SysUtils.FileSetAttr('C:\YourFolder\Desktop.ini',
SysUtils.faSysFile or SysUtils.faHidden) ;
iniFile.Free ;
end;
end.
更多精彩
赞助商链接