Delphi改变文件夹图标


本文整理自网络,侵删。

 代码: 
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.

里面的YourFolder可以自己改文件夹的名称

相关阅读 >>

Delphi 上传文件到七牛,纯原生

Delphi 判断文件名是否有效

Delphi 两字符串之间添加分隔符

Delphi xe8安卓下汉字转gb2312 urlencode代码

Delphi 双击listbox1内容,数据插入到memo1/synedit1鼠标指定位置

Delphi datasnap(midas)三层架构中,常用事件及其触发顺序

Delphi 2010/xe下隐藏程序在系统任务栏的图标

Delphi asc转换成unicode

Delphi 10 seattle中使用本地通知,请使用tnotificationcenter组件

Delphi leftstr 返回字符串左边指定个数的新字符(串)

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...