home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 April
/
Chip_1997-04_cd.bin
/
tema
/
602propc
/
disk12
/
data.12
/
WINTEXT
/
MAKRA
/
SOURCES
/
MALOVANI.TXT
< prev
next >
Wrap
Text File
|
1995-03-13
|
4KB
|
155 lines
Program Malovani;
// p°φklad pou₧itφ externφch funkcφ ze syst. knihoven Windows
const
uroven = 99;
opakovani = 130;
penwidth = 50;
function MessageBox(x:short; var s,t:string[20]; y: short) :
short;
external 'USER.EXE' name 'MESSAGEBOX';
function TextOut(x,y,z:short; var s:string[1]; v: short) :
short;
external 'GDI.EXE' name 'TEXTOUT';
function SetWindowPos(u,v,w,x,y,z,zz:short) : short;
external 'USER.EXE' name 'SetWindowPos';
function ShowWindow(u,v:short) : short;
external 'USER.EXE' name 'ShowWindow';
function GetCurrentTime : integer;
external 'USER.EXE' name 'GETCURRENTTIME';
function GetInputState: short;
external 'USER.EXE' name 'GETINPUTSTATE';
function GetActiveWindow : short;
external 'USER.EXE' name 'GETACTIVEWINDOW';
function GetWindowDC(x:short) : short;
external 'USER.EXE' name 'GETWINDOWDC';
function ReleaseDC(x,y:short) : short;
external 'USER.EXE' name 'RELEASEDC';
function CreatePen(x, y, z : integer): short;
external 'GDI.EXE' name 'CREATEPEN';
function DeleteObject(x: short): short;
external 'GDI.EXE' name 'DELETEOBJECT';
function SelectObject(x, y: short): short;
external 'GDI.EXE' name 'SELECTOBJECT';
function MoveTo(x,y,z: short): short;
external 'GDI.EXE' name 'MOVETO';
function LineTo(x,y,z: short): short;
external 'GDI.EXE' name 'LINETO';
var
d_start : date;
t_start : time;
hwnd, hdc, hpen, hpenOld : short;
i, j, is, js, k, l : short;
seed : integer;
s : string[20];
function Random(mez : short):short;
const
c1 = 13849;
c2 = 27181;
c3 = 65536;
var
pom : integer;
begin
seed := (c1 + (c2 * seed)) mod c3;
pom := Round(seed / (65536 / mez));
if pom = 0 then pom := 1;
Random := pom;
end;
function RGB(r,g,b : short): integer;
begin
RGB := (b*256 + g)*256 + r;
end;
function konec : boolean;
const
Miliseconds = 3000;
var
dt : date;
tm : time;
limit : boolean;
begin
dt := Today;
tm := Now;
limit := Day(dt) <> Day(d_start);
if not limit then
limit := tm - t_start > Miliseconds;
if limit
then konec := GetInputState <> 0
else konec := false;
end;
begin
d_start := Today;
t_start := Now;
seed := Seconds(t_start);
hwnd := GetActiveWindow;
hDC := GetWindowDC(hwnd);
hpen := CreatePen(0, Random(penwidth),
RGB(Random(255), Random(255), Random(255)));
hpenOld := SelectObject(hDC, hpen);
k := 0;
i := 10;
j := 10;
is := Random(uroven);
js := Random(uroven);
repeat
if (i+is>640) or (i+is<0) then
begin
SelectObject(hDC, hpenOld);
DeleteObject(hpen);
hpen := CreatePen(0, Random(penwidth),
RGB(Random(255), Random(255), Random(255)));
hpenOld := SelectObject(hDC, hpen);
if is > 0
then is := -Random(uroven)
else is := Random(uroven);
end;
if (j+js>480) or (j+js<0) then
begin
SelectObject(hDC, hpenOld);
DeleteObject(hpen);
hpen := CreatePen(0, Random(penwidth),
RGB(Random(255), Random(255), Random(255)));
hpenOld := SelectObject(hDC, hpen);
if js > 0
then js := -Random(uroven)
else js := Random(uroven);
end;
MoveTo( hDC, i, j);
i := i + is;
j := j + js;
LineTo( hDC, i, j);
k := k + 1;
if (k mod opakovani = 0) and (GetInputState = 0) then
begin
TextOut(hDC, Random(600), Random(400),
"Klikni nebo stiskni klßvesu...", 30);
end;
until konec;
SelectObject(hDC, hpenOld);
DeleteObject(hpen);
ReleaseDC(hwnd, hDC);
/* SetWindowPos(hwnd, 1,0,0,0,0, 1 or 2);
SetWindowPos(hwnd, 0,0,0,0,0, 1 or 2 or 64);*/
ShowWindow(hwnd, 2);
ShowWindow(hwnd, 3);
MessageBox(0, "Konec makra", "Makro", 0 or 64 || 8192);
end.