说白修改文件里的隐藏文件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.
新闻热点
疑难解答