WEB开发网
开发学院软件开发Delphi 改变文件夹图标 阅读

改变文件夹图标

 2006-02-04 13:55:30 来源:WEB开发网   
核心提示: 说白修改文件里的隐藏文件desktop.ini下面是源代码unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TFor
 

说白修改文件里的隐藏文件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.


Tags:改变 文件夹 图标

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接