Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

(Ebook - Pdf) Kick Ass Delphi Programming

.pdf
Скачиваний:
284
Добавлен:
17.08.2013
Размер:
5.02 Mб
Скачать

12.1(Event handler to begin drag), 327

12.2(Checking for the acceptability of a drop), 328

12.3(Calculating the date), 328-329

12.4(Drag/drop demo), 329-332

12.5(A unit for packing Paradox and dBASE tables), 333-336

12.6(Code for the packing demo), 337-340

12.7(Main form of the key swapping demo), 344-346

12.8(Secondary entry form for the swapping demo), 346-347

12.9(TApplication’s ProcessMessage method), 347

12.10(Playing WAV files), 350-351]

13.1(Form Resize demo), 359-361

13.2(Test app for TSplashDialog), 366-367

13.3(TSplashDialog component), 368-374

13.4(Data Module demo), 378-379

13.5(Data Module demo’s main form), 381-382

13.6(Data Module demo’s secondary form), 383-384

13.7(WalkStuf unit), 390-398

13.8Walking demo), 400-405

14.1(Handlers for OnDragOver and OnDragDrop), 414

14.2(Common event handler demo), 416-422

14.3(Single-instance program), 427-428

14.4(Project file for One Instance demo), 428-429

14.5(No Run Demoi’s main form), 431-432

14.6(No Run demo project file), 433

14.7(Floating Toolbar demo), 434-439

15.1(Prototype of message transmission routine), 457

15.2(Prototype of message reception routine), 458

15.3(DLL for sender/receiver component support), 459-467

15.4(Using a semaphore to control memory access), 469-470

15.5(MsgSender component), 473-478

15.6(MsgReceiver component), 480-485

15.7(Constants for Sender and Receiver demo apps), 491

15.8(Code for Receiver demo), 492-494

15.9(Code for Sender demo), 497-501

M

Math unit

advantages, 239

arithmetic functions and procedures, 255

defined, 239

dynamic data declarations, 240 financial functions and procedures, 256 hard coding values, 240

IntPower function, 254 mean function, 240

MinValue and MaxValue, 250 overdeclaring the size of the array, 240 passing dynamic data to functions, 241 Poly function, 250

PolyProject example, 251 power function, 254 retrieving data, 246

slice function, 241

statistical functions and procedures, 257 storing data, 242

TBDStatistics. See TDBStatistics trigonometric functions and procedures, 254

MEMOEDIT.EXE, 317

Memory files, 470

create file mapping, 468 semaphores, 469 shared, 426

single instance of applications, 426 Message IDs, 456-457

Messages, 358

between sender and receiver, 457 TWMGETMINMAXINFO, 359 WM_GETMINMAXINFO, 358

Messaging

restoring original, 488 Methods

animate, 221 begindrag, 324, 327 cursoroff, 220 execute, 367 FormCreate, 219-220 GetButtons, 208 IdleProc, 221 Loaded, 192 MouseDown, 198

MouseMove, 198

MouseUp, 198

Paint, 266

ProcessMessage, 347

Read, 189

SetTabSizes, 423

SetTopMost, 220

ShowStatus, 502

TTable, 332

Write, 189, 190

MMSystem unit

playsound, 351 ModuleSysInstCount, 398 MsgReceiver

creating, 480 MsgSender component, 473

N

Notebook, 415

O

Object Inspector, 6, 262, 277, 377, 384, 413, 415 adjusting control properties, 277

events page, 138

installing TMINIINSPECTOR, 278 TMINIINSPECTOR, 278

Object Pascal

command line processing, 11 moving through an array, 471 param count, 11

param str, 11 Object Repository, 5

creating console apps template, 7 Objrepos subdirectory, 7

OnCreate handler, 359, 367

OnDragDrop event, 325

OnDragEnd event, 325

OnDragOver event, 324

OnDragOver events handler

parameters, 327 OnEndDrag event handler, 329

OnMessage event, 343

OnMessage event handler, 347-348

OnMouseDown event, 326

OnMouseDown event handler, 326

OnResize event handler, 363

OptionRec, 20

Orpheus VCL library, 431

Orpheus VCL package

ovc calandar, 325 OvcCalendar, 325, 328

initialize property, 329 Owner window

subclassing, 485

P

PaBDE routines, 333 DBIPackTable command, 336 example, 337

PackTable, 336

PakTable.pas, 333

TTable method, 332

PackTable, 336

tabletype, 336

PageControl, 414-418, 420-421, 423

tab height, 415

tab width, 415 Panels, 434

Paradox

adding data, 377

deleting excess space in tables, 332 deleting records vs. Dbase, 336 PIZADATA.DB, 377

using BDE routines to pack, 333 ParamCount, 11

Params program, 11

ParamStr, 11

Persistents

partial-loading, 192 PERSIST.SRC, 191 PERSIST2.SRC, 192 read method, 190

TPersistent, 189 write method, 189

Personal Information Managers. See PIMs.

PICTEDIT.EXE, 318

PIMs, 261

Poly function, 250 defined, 251

polyproject example, 251 Process ID, 389 ProcessMessage method, 347 Process-oriented programming

vs. event-oriented, 5 Program structure

separating hand written code, 23 Project file

and hand written code, 23 single instance, 428

Project Options

linker page, 6

Properties, 189

active, 384

descendents of TPersistent, 189 font, 423

height, 423

inherited with redeclared, 201 MasterSource, 292

read method, 189 service, 136 SetColct.src, 203 SizeChan.src, 202 tag, 384

write method, 189

R

Radio buttons disabling, 206

getbuttons method, 208 RBTNGRPS.PAS, 207 TRADIOGROUP, 207

RDTSC, 193

COMP2STR.SRC, 194 COMPOSTR function, 194 pentium benchmarking, 193 problems, 194 RDTSC.SRC, 194

Read method, 189 returning nil, 190

Read Time Stamp Counter. See RDTSC.

Receiver component

creating, 480 example, 492

MSGRECEIVERIDMESSAGE method, 494 sharing messages with sender, 456

RegisterWindowMessage, 456, 457

Resolver

deriving the name of a host from its internet address, 117 reporting your name to the network, 113

resolving a host name in blocking mode, 114 resolving the host name, 119

retrieving a host name by internet address only, 124 running, 111

WSAAYNCGETHOSTBYADDR, 124

Routines

default handler, 485 dispatch, 485 dropeditstring, 415 OnDragOver, 415 plasma, 185 Process32First, 389 Process32Next, 389 project(), 182 StringWidth, 423 TaskFirst, 388 TaskNext, 388

S

Screen savers, 211

Animate method, 221

Application object, 219

BorderStyle property, 219

Color ComboBox, 228

Color property, 219

FCurrPoint field, 219

FFirstPass field, 219

FMousePt field, 219

FormCreate method, 219-220

IdleProc method, 221

LaserFrm form file, 211

LASERFRM.PAS, 212

LoadSettings procedure, 220

OnIdle event, 220

project file, 233 randomize procedure, 219 screen object, 219 SetTopMost method, 220

SETWINDOWPOS function, 220 trackbars, 224 TRZCOLORCOMBOBOX, 232 Waimessage function, 221 Windowstate property, 219

Semaphores, 469

CreateSemaphore, 469

to control memory access, 469 WaitForSingleObject, 469

Sender, 327

and begindrag method, 327 Sender component, 456

creating, 472 example, 497 msgsender, 472

sending messages to handles from a querey, 456 sharing messages with receiver, 456

Slice function, 241

Source, 327

and BeginDrag method, 327 Splash screens, 365

as a component, 365 creating, 365 source code, 368

TSplashDialogue, 366 wrapper, 365

String collections

and string lists, 198 STRLIST.PAS, 199 TStringCollection, 199

String lists, 198

StringWidth, 423

Subclassing, 57

custom responses to windows messages, 54 SvrUtils unit, 220

loadsettings procedure, 220 System unit

slice function, 241

T

Tab Order, 273

TabGrid, 423

TableType, 336

TabSet, 415

TabWidth, 423

Tag property, 384

TApplication, 347

ProcessMessage method, 347

TControl class, 39

TDBStatistics, 239

creating, 241

datafield property, 242 defining tasks, 241 extracting data, 242-243 FillSrray, 245 GetAllStats, 246 GetRange, 243

LowerBound property, 243 retrieving data, 246 StatsProject example, 247 storing data, 242 TDataSource, 242 TDataSource property, 242 UpperBound property, 243

TFileStream class, 283

TForm, 365

TImage component, 368

TMiniInspector, 278

installing, 278

TObject

default handler, 485 dispatch, 485

event handling, 486 inherent messaging, 485

Toolbars, 434

floating, 434

OnMouseDown event, 439 OnMouseMove event, 439 OnMouseUp event, 439 panels, 434

ToolBarMouseMove event handler, 439 ToolHelp, 388

16-bit vs. 32-bit versions, 388

create tool help 32 Snapshot, 389. See also CreateToolHelp32Snapshot.

Snapshot capability, 389

TPersistent

descendents of, 189 read method, 190 write method, 189

TPicture, 368, 374

Tree hierarchy, 287

displaying data, 296 lineage, 288 navigating, 294 progeny, 288

TreeData

combobox, 309 components, 306 internals, 308 listbox, 310 outline, 310 update, 310

TRzColorComboBox selected color, 232 showsyscolors, 232

TTable method, 332

TWinControl, 486

event handling, 486 MAINWNDPROC, 486 WNDPROCMAINWNDPROC, 486

U

User Interfaces

abandoning changes, 272

adjusting a single control’s font, 276 adjusting control fonts, 276 adjusting the tab order, 273

and hierarchical data, 298 changing properties, 277 designing tools, 263 dynamic, 261

moving controls, 264 object inspector, 277 ReleaseCapture, 264 resizing controls, 267

responding to a popup menu, 269 saving component changes, 279

saving components with components as properties, 280 TFileStream class, 283

it-yourself example, 263 WM_SYSCOMMAND, 265

Uses statement, 74

V

Variables

handled, 347

W

WalkStuf, 398, 433 GetLocalModuleList, 398 GetProcessModules, 398 GetSystemModuleList, 398, 399 GetSystemProcessList, 398 kernel32, 398 ModuleSysinstCount, 398, 426 Process32First, 398 ProcHandle, 398