Skip to content

Commit

Permalink
Skin Form dynamic creation added and Windows Taskbar Settings menu added
Browse files Browse the repository at this point in the history
  • Loading branch information
vhanla committed Oct 31, 2019
1 parent 0df19f8 commit 1506a37
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ TForm1 = class(TUForm)
chkSkinEnabled: TEsSwitch;
chkSmall: TEsSwitch;
chkAnimation: TEsSwitch;
mnuTaskbarSettings: TMenuItem;
procedure Exit1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
Expand Down Expand Up @@ -133,6 +134,7 @@ TForm1 = class(TUForm)
procedure chkSmallClick(Sender: TObject);
procedure chkAnimationClick(Sender: TObject);
procedure tbsSettingsShow(Sender: TObject);
procedure mnuTaskbarSettingsClick(Sender: TObject);
private
{ Private declarations }
ms: TPoint;
Expand Down Expand Up @@ -200,7 +202,8 @@ implementation

uses skinform, functions, settings;


var
skinFrm: TForm2;


procedure TForm1.mnuAboutClick(Sender: TObject);
Expand All @@ -211,6 +214,11 @@ procedure TForm1.mnuAboutClick(Sender: TObject);
#13#13'https://github.com/vhanla/taskbardock',mtInformation, [mbOK], 0);
end;

procedure TForm1.mnuTaskbarSettingsClick(Sender: TObject);
begin
WinExec(PAnsiChar('rundll32.exe shell32.dll, Options_RunDLL 1'), SW_SHOWNORMAL);
end;

procedure TForm1.AutoStartState;
var
reg: TRegistry;
Expand Down Expand Up @@ -746,19 +754,22 @@ procedure TForm1.tmrCenterTimer(Sender: TObject);

if chkSkinEnabled.Checked then
begin
if not IsWindowVisible(Form2.Handle) then
Form2.Show;
if skinFrm = nil then
skinFrm := TForm2.CreateNew(Self,Taskbars.MainTaskbar.Handle);

if not IsWindowVisible(skinFrm.Handle) then
skinFrm.Show;

MainTaskbar := Taskbars.MainTaskbar;

if MainTaskbar <> nil then
begin
if MainTaskbar.MSTaskRect.Left <> Taskbars.MainTaskbar.MSTaskListWClass.Rect.Left then
begin
skinform.Form2.Width := MainTaskbar.MSTaskListWClass.Rect.Width; //Taskbar.MSTaskListRect.Width;
skinform.Form2.Height := MainTaskbar.MSTaskListWClass.Rect.Height;
skinform.Form2.Top := MainTaskbar.MSTaskListWClass.Rect.Top;
skinform.Form2.Left := MainTaskbar.MSTaskListWClass.Rect.Left;
skinFrm.Width := MainTaskbar.MSTaskListWClass.Rect.Width; //Taskbar.MSTaskListRect.Width;
skinFrm.Height := MainTaskbar.MSTaskListWClass.Rect.Height;
skinFrm.Top := MainTaskbar.MSTaskListWClass.Rect.Top;
skinFrm.Left := MainTaskbar.MSTaskListWClass.Rect.Left;
end;
end;

Expand Down Expand Up @@ -837,8 +848,8 @@ procedure TForm1.tmrCenterTimer(Sender: TObject);
end
else
begin
if IsWindowVisible(Form2.Handle) then
Form2.Hide;
if IsWindowVisible(skinFrm.Handle) then
skinFrm.Hide;
end;
end;
end;
Expand Down

0 comments on commit 1506a37

Please sign in to comment.