Skip to content

Commit

Permalink
Added property to read and write Windows taskbar's thumbnail animation
Browse files Browse the repository at this point in the history
  • Loading branch information
vhanla committed Oct 15, 2019
1 parent 975222e commit 5413c46
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions taskbar.pas
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ TTaskbars = class(TList)
function GetAutoHideInfo: Boolean;
procedure SetAutoHide(state: Boolean);
function GetSmallIcons: Boolean;
function GetAnimationState: Boolean;
procedure SetSmallIcons(Value: Boolean);
procedure SetAnimationState(Value: Boolean);
public
function Add(Value: PTaskbar): Integer;
procedure Refresh;
Expand All @@ -189,6 +191,7 @@ TTaskbars = class(TList)
property MainTaskbar: PTaskbar read GetMainTaskbar;
property Autohide: Boolean read GetAutoHideInfo write SetAutoHide;
property SmallIcons: Boolean read GetSmallIcons write SetSmallIcons;
property TaskbarAnimation: Boolean read GetAnimationState write SetAnimationState;
procedure UpdateTaskbarInfo;
procedure Transparent(Value: Boolean = True);
procedure BeginUpdate;
Expand Down Expand Up @@ -415,6 +418,22 @@ function TTaskbars.Get(Index: Integer): PTaskbar;
Result := PTaskbar(inherited Get(Index));
end;

function TTaskbars.GetAnimationState: Boolean;
var
reg: TRegistry;
begin
reg := TRegistry.Create;
try
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKeyReadOnly('SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced');
if reg.ReadInteger('TaskbarAnimations') = 1 then Result := True
else
Result := False;
finally
reg.Free;
end;
end;

function TTaskbars.GetAutoHideInfo: Boolean;
var
ABData: TAppBarData;
Expand Down Expand Up @@ -711,6 +730,24 @@ procedure TTaskbars.RestoreOpacity(Handle: THandle);
SendNotifyMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, LongInt(PChar('TraySettings')));
end;

procedure TTaskbars.SetAnimationState(Value: Boolean);
var
reg: TRegistry;
begin
reg := TRegistry.Create;
try
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced', False);
if Value then
reg.WriteInteger('TaskbarAnimations', 1)
else
reg.WriteInteger('TaskbarAnimations', 0);
SendNotifyMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, LongInt(PChar('TraySettings')));
finally
reg.Free;
end;
end;

procedure TTaskbars.SetAutoHide(state: Boolean);
var
ABData: TAppBarData;
Expand Down

0 comments on commit 5413c46

Please sign in to comment.