procedure WindowShake(wHandle: THandle) ;
const MAXDELTA = 4;
SHAKETIMES = 500;
var
oRect, wRect :TRect;
deltax : integer;
deltay : integer;
cnt : integer;
dx, dy : integer;
begin
GetWindowRect(wHandle,wRect) ;
oRect := wRect;
Randomize;
for cnt := 0 to SHAKETIMES do
begin deltax := Round(Random(MAXDELTA)) ;
deltay := Round(Random(MAXDELTA)) ;
dx := Round(1 + Random(2)) ;
if dx = 2 then dx := -1;
dy := Round(1 + Random(2)) ;
if dy = 2 then dy := -1;
OffsetRect(wRect,dx * deltax, dy * deltay) ;
MoveWindow(wHandle, wRect.Left,wRect.Top,wRect.Right - wRect.Left,wRect.Bottom - wRect.Top,true) ;
end;
MoveWindow(wHandle, oRect.Left,oRect.Top,oRect.Right - oRect.Left,oRect.Bottom - oRect.Top,true) ;
end;
علاقه مندی ها (بوک مارک ها)