• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

[原创]Delphi编程之Win10桌面图标设置 - 过往云霄

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

[原创]Delphi编程之Win10桌面图标设置

具体代码如下:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.StdCtrls, Registry, ShlObj;

type
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    CheckBox5: TCheckBox;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Reg:TRegistry;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
//
if CheckBox1.Checked then
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey(\'\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\',True);
Reg.WriteInteger(\'{20D04FE0-3AEA-1069-A2D8-08002B30309D}\',0); //显示计算机/这台电脑/此电脑
Reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,nil,nil)//刷新桌面显示
end
else
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey(\'\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\',True);
Reg.WriteInteger(\'{20D04FE0-3AEA-1069-A2D8-08002B30309D}\',1); //隐藏计算机/这台电脑/此电脑
Reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,nil,nil);//刷新桌面显示
end;

if CheckBox2.Checked then
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey(\'\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\',True);
Reg.WriteInteger(\'{59031a47-3f72-44a7-89c5-5595fe6b30ee}\',0); //显示用户
Reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,nil,nil)//刷新桌面显示
end
else
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey(\'\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\',True);
Reg.WriteInteger(\'{59031a47-3f72-44a7-89c5-5595fe6b30ee}\',1); //隐藏用户
Reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,nil,nil);//刷新桌面显示
end;

if CheckBox3.Checked then
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey(\'\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\',True);
Reg.WriteInteger(\'{645FF040-5081-101B-9F08-00AA002F954E}\',0); //显示回收站
Reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,nil,nil)//刷新桌面显示
end
else
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey(\'\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\',True);
Reg.WriteInteger(\'{645FF040-5081-101B-9F08-00AA002F954E}\',1); //隐藏回收站
Reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,nil,nil);//刷新桌面显示
end;

if CheckBox4.Checked then
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey(\'\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\',True);
Reg.WriteInteger(\'{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}\',0); //显示控制面板
Reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,nil,nil)//刷新桌面显示
end
else
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey(\'\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\',True);
Reg.WriteInteger(\'{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}\',1); //隐藏控制面板
Reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,nil,nil);//刷新桌面显示
end;

if CheckBox5.Checked then
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey(\'\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\',True);
Reg.WriteInteger(\'{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}\',0); //显示网络
Reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,nil,nil)//刷新桌面显示
end
else
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey(\'\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\',True);
Reg.WriteInteger(\'{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}\',1); //隐藏网络
Reg.Free;
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST,nil,nil);//刷新桌面显示
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;

end.

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
delphi self 的使用发布时间:2022-07-18
下一篇:
matlab load pkl发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap