program Project1;
{$APPTYPE CONSOLE}
uses
Windows,
Messages;
Const
Pas=10;
var
lar:Integer;
fpo:TRect;
H,Hand,Timer: THandle;
b:boolean;
procedure FindChildWindows(Ha: Integer);
var
h: THandle;
begin
h := GetWindow(Ha, GW_CHILD);
While h <> 0 do
Begin
InvalidateRect(H,nil,True);
FindChildWindows(h);
h := GetWindow(h, GW_HWNDNEXT);
End;
end;
procedure Timer1Timer;
var
n:integer;
begin
case b of
False:begin
n:=fpo.Left+pas;
if n+fpo.Right<lar then fpo.Left:=n
else b:=True;
end;
True:begin
if fpo.Left>pas then fpo.Left:=fpo.Left-pas
else b:=False;
end;
end;
MoveWindow(Hand,fpo.Left,fpo.Top,fpo.Right,fpo.Bottom,false);
InvalidateRect(H,nil,True);
FindChildWindows(h);
end;
procedure FormCreate;
var
po:TRect;
begin
Timer:=SetTimer(0,0,100,nil);
H := FindWindow('Shell_TrayWnd', nil);
Hand := FindWindowEx(H, 0, 'Button', nil);
GetWindowRect(H,Po);
GetWindowRect(Hand,fPo);
fpo.Bottom:=fpo.Bottom-fpo.Top;
fpo.Top:=0;
fpo.Right:=fpo.Right-fpo.Left;
lar:=po.Right;
b:=False;
end;
Procedure FormDestroy(n:Dword);
begin
MoveWindow(Hand,0,0,fpo.Right,fpo.Bottom,false);
InvalidateRect(H,nil,True);
FindChildWindows(h);
KillTimer(Timer,0);
end;
var
Msg: TMsg;
begin
SetConsoleCtrlHandler(@FormDestroy,True);
FormCreate;
repeat
if PeekMessage(Msg, 0, 0, 0, PM_REMOVE) and
(msg.message=WM_TIMER) then Timer1Timer;
until False;
end.