    Special Edition
    USING 
    DELPHI 3 

    Written by Todd illr and David Powell with 

    Roland Eoucbereau  Julian BuchiaU  Bill Curtis  Scott Frolich 
    Joe C. Hecht  Chaim Krause  Mark Pritchard    Noel Rice 
    J.W. Rider  Quentin Saraftnchan  Stephen A. Scbafer  Eric Uber 

    QUE 

4

      
     
    DELPHI 3 
         
      *            
         .      
    
     -  
    1997 

5

     32.973-01 60 
     "" .  ..  
       .. , . .  .. , .. 
, .. , .. , .. , ..  
      .. , . .  ..   
 ..  
          ""    
: 261-5936, 261-5643,  227-1456 
    Internet: marin@dcp.kiev.ua, http://www.dcp.kiev.ua 
          : diamail@dcp.kiev.ua 
     
     : -419, 117419, / 10, ./ 955-5288, 955-5397  
: -6, 252006, / 100, ./ 268-6027, 230-2667, 261-9287 
    , , ,   . 
    60       Delphi 3.  . : .  .  . 
: , 1997.  768 . : .  , . . 
    ISBN 966-506-092-9 (.) 
            
Delphi 3    .     
 ,   ,    
.       OLE  ActiveX. 
 ,       16-  
32-  Windows,    ,    
  .       
Internet    ,   Web-. 
  Borland     
     Delphi 3,  
   Delphi  C++,    
  Windows API. 
         . 
     32.973-01 
           
  . 
               
              , 
    ,      
 ,        QUE 
Corporation, 1997. 
    Authorized translation from the English language edition published by Que 
Corporation Copyright 1997 
    All rights reserved. No part of this book may be reproduced or transmitted 
in any form or by any means, electronic or mechanical, including photocopying, 
recording or by any information storage retrieval system, without permission 
from the Publisher. Russian language edition published by Dialektika Computer 
Publishing. Copyright 1997 
    ISBN 0-7897-1118-4 (.) 
     QUE Corporation, 1997 
    ISBN 966-506-092-9 (.)                                                  
                                                                               
                                                                               
           * 
     ,  "" , 1997 

6

      
     
      (Todd Miller)       
 .       
  ,       
   dBASE  Borland International  
  .       
  Delphi.     Delphi,   
 Delphi 1,      Delphi 
Client/Server.    -,  ,      
            .  
      CompuServe: 71333,2144. 
      (David Powell)     Delphi 
Client/Server,        
Delphi  Borland International.      
    -.    
 Turbo Pascal 3    Pascal.  
     :     
       - . 
   -,  ,      . 
       CompuServe: 76711,1441. 

     

      (Roland Bouchereau)  -  Borland 
International.        
 14 .      Client/Server. 
       A/R  /.   
      .      
  CompuServe: 75300,1734. 
      (Julian Bucknall) ,    
    ,        18 . 
      TurboPower 
Software        ,  
   ,  ,    
  Delphi,  Orpheus, Async Professional for Delphi, 
SysTools  FlashFilter.       
,      -.     
   (Jeff Riley)      ( 
  ), C           
        ,    ,     
  .        
CompuServe: 100116,1572. 
      (Bill Curtis)      
 SQL Links/Connectivity.        BDE 
 SQL Links  Borland,     ,  
        
Client/Server.         . 
         .    
-,  ,    . 


7

      (Scott Frolich)  -  Borland 
International,      Delphi. 
      Delphi, BDE, BDE API, 
InterBase  SQL.    Delphi   1994 .   
         
 .        , 
  .        
CompuServe: 74431,257. 
      (Joe Hecht)      1976    
  12       
      DOS,    Windows.   
     Delphi  Borland 
International.    Internet  joehecht@gte.net,   
CompuServe  70714,1353. 
      (Mark Pritchard)        
GUI        
- .    , 
        
   Delphi, C++,   VB.      
Internet: pritchardma@ozeniail.com.au. 
      (Chaim Krause)      
 Delphi  Borland International.    
 ,    .    
         ,   
  .    Internet  chaim@chaim.c om. 
      (Noel Rice)  ,     
 Delphi  Borland International.     
, .   ,  .     
   (nrice@iix.netcom),   Internet (pwl.netcom.com/~nrice/home.html). 
    .  (J. Rider) --  -  
Pragmatics, Inc., McLean, VA,      
       
  Delphi Client/Server.    Pragmatics   
    .  ,   
         
   Delphi       
Delphi  Borland.     ,  .  
   10001.4652@compuserve.com. 
      (Quentin Sarafinchan)    Borland   
  Delphi.     
,   .        
(      )      
. 
      (Steve Schafer)      
  .    ,    
          
 .      .  
 11        (  
Fortran II),  ""   .     
     .  1985      
Turbo/Borland/Pascal,   1991      
 Delphi  Borland.       
CompuServe   DELPHI  BDELPHI32 .       
767111.522@compuserve.com  pandeng@telepath.com. 
      (Eric Uber)      Delphi- 
 Borland.       
 Delphi,      
  C++ Builder.      Ellipsys 
Technologies,      .  
     QUE.   
.       ezee@compuserve.com. 


8

      

      (David Rippy)    Ensemble Corporation, 
        
Client/Server  Internet.      Delphi Informant  
      .    
    CompuServe: 74444,415. 
      (Alain Tadros)       
Delphi-,   COM, OLE   ActiveX.  
        
 ActiveX Framework  Delphi 3.0.       
Borland,        Delphi  C++.  
         Web-  
 Borland,   COM, OLE, ActiveX   
   C++  Delphi.    -,  , 
     .      Internet: atadros@wpo.borland.com. 


9

    , ! 
          ,   
  .     ,  
   ,    (  )   
    . 
      ,     : 
    The Expert User Team E-mail: euteam@que.mcp.com 
    CompuServe: 72410,2077 Fax:(317)581-4663 
      : The Expert User Team Que Corporation 201 West 103rd 
Street Indianapolis, IN 46290-1097 
       World Wide Web: http://www.mcp.com/que/developer_expert 
         . 
      "" 
           , 
         : 252005, -5, 
/ 152, 
    ""   : marin@dcp.kiev.ua. 
     ,           . 


10

          I 

      

    1.    Delphi 3 

    2.   Delphi 

    3. Object Pascal:   

    4. Object Pascal:   

    5.    

11

       Delphi 3 

         1 

      


     Delphi 

        Delphi,    . 

     Delphi 3 

         Borland   . 

           

      ,   .      
,            
 . 



      !   Delphi 3,  
,             
Delphi! Delphi 3       , 
        , 
    -   Pascal. 
Delphi 3        Win32-co 
,   ""  ,  
   . 
     Borland    .  , 
,       Delphi      
,      !   
 ,        ! Delphi 
3            
 ( ),       
      ,    . 
     : ",   ,       
    ".  Delphi     
            
    Delphi. ,  PC Magazine 
 Delphi  " " (Technical Excellence)   
  (Development Tools), a ComputerWorld    
  Delphi   .   , 
  Delphi,       
 Visual Basic Programmers Journal Delphi   Editor's 
Choice. ,     Internet,     
  Delphi,    http://www.borland.eom.delphi/delaward.html. 
    ,  ,    ,    
Delphi 3    .       , 
 (  )  .   

12

          
.  ,        (Todd 
Miller)    (David Powell)      
   Delphi.   ,  ,  
 .    Delphi  ,       
(   ). 

     

             
. ,     , 
  .         ,  C++  Visual 
Basic, ,   ,      
  Delphi.           
Pascal      Delphi,      
     . 


      Delphi 


    Delphi       .    
,       . 

       

             
,  ,   . 
Windows-        
       
  . Delphi,      ,  
 . , Open Tools API (Application Programming Interface  
  )    , 
   (auto-save expert),    
   Delphi (Integrated Development Environment, 
 IDE). Open Tools API   29, "    Open Tools API". 

      

     ,  Visual Basic,  -  
    ,      
- ,   ,  
 . Delphi   .   
- ,        
  (),    ()  
  -,     (). 

      

    ,     ,   ,  
 Windows,  .      
         ,  
   ,    . 
Delphi ""         
       ""    ,  
 .     ,   
,     ,   Win32. 
    -  Delphi    
 .        
   ,     
,     ,    ""! 

     OCX  ActiveX 

    Delphi  ,       
(, C++)    OCX. OCX-    
 ,   , 
        
:  Web-  ""    
   . ActiveX    
 OCX       ,   
  Internet.   Delphi   
ActiveX       Internet,    
 . 

     1.    Delphi 3 13 

     

    ,   ,       
     OCX (    
    ),    ,    
  ! Delphi    : , 
,   .  ,    
         
  ,       .  
    ,       
  . (      
" Delphi 3"). 

      

         Windows  
-,  -,        
      ,   
  . -    
     ! Delphi  
        
 .     ,   
     ,    
 ! 
          , 
      (DLL),  
      .   
        Delphi  
      . 

       

          , , , 
       .  
           
 .        
      .   
   ,       . 
Delphi         
  .      , 
       ,    
  , Delphi   , 
      .    
 Delphi   ,   
-   .   
      ,      
    ,    <>   . 

       

          ,     
  .  ,     
      .   ,    
     ,     ,   
 .    (  ),  
      . Delphi    
   ,      
     .  ,   ,   
 Delphi      ,    
  ! 

     Delphi 3 

       Delphi     
,            
.       :   
        Delphi 3. 

    14  I.   


       IDE 

           (IDE)  
      (look-and-feel)  Internet 
Explorer    .     
   ,     . 

        DLL 

      Delphi      
  (DLL),      
       .  Delphi 
3          DLL  
 . (  DLL    27.) 

        

           . 

      

       (Code Editor)    (gutters), 
   ,   ,  
    .      
        
  . 

       

          ( 
  ,   ,      
    )     , 
 ,          
      (   
  ). 

      

         .    
      ,  if. . .then. . .else 
 for. . .do?      ,   
  ,         
.       2 , " 
 Delphi". 

       

       Internet    
      .    
  ,   -  ,  
         . 

      

      Delphi     
    ,       
      .  Delphi 3  
       , 
   ,       
  .       
   -   . (  
 16, " ".) 

       VCL  RTL 

      (    )   
 (Visual Component Library  VCL)    
 (Runtime Library  RTL).     
  ,    . 

      

         VCL Delphi 3,    
 6, "  Delphi",  7, "   Win32". 

     1.    Delphi 3 15 

    TSplitter 

     TSplitter      , 
        .  
Windows (explorer)     : 
      ,   
        . 
    
    TAnimate 

           
TMediaPlayer   AVI- (Audio Video Interleaved)   
  . 

    TlmageList 

     TlmageList,     Delphi,  
    .    
    . 

    TToolbar 

     ,      Delphi,  
     TPanel.  Delphi 3 
 TToolbar     TPanel,     
  ,    . 

    TCoolBar 

          Internet Explorer,   
    TCoolBar,       
    Delphi ""   Internet Explorer. 

    TOpenPictureDialog  TSavePictureDialog 

             
     ,  
       . 

     Internet 

          ,   
  ,     Internet.  
,     HTTP, HTML, FTP, NNTP, POP, 
SMTP, TCP  UDP,         
.        ,  
 ,       ,  
      Internet!  
  Internet     28, "   
Web-"'. 

      

     Delphi 3  ,     
   Delphi. 

    TSpeedButton 

       Flat.     True,  
TSpeedButton     Web- Microsoft Internet Explorer. 

    TFont 

         ,  TFont 
  Chartset,     . 

    TCanvas 

            
     TCanvas  
  Tthread.Synchronize.  Delphi 3     
   TCanvas    : Lock  UnLock.  Lock 
       TCanvas, a 
UnLock  . 

        

      ,      VCL  
RTL,     . 

    16  I.   


    Assert 

      Assert      
 "   ".     , 
    .     
,         
  . 

      

        Delphi    
 ,         
  (DLL).       ,  
        
 (VCL).  Delphi 3        
,     DLL.   
       ,    
.      :      
      DLL. 

       Visual Basic 

      Delphi   DLL   
 ActiveX        , 
   Visual Basic (VC).      
 Visual Basic     Delphi,  ByteBool, 
WordBool  LongBool,   True,  1.   -1. 
False   0.     Boolean    
   True  False  1  0 . 

    WideSpring 

     WideSpring,      , 
 16-  Unicode      
 String (       
 ). 

       OLE 

     OLE    Delphi 3.  OLE 
   Component Object Model (COM)   ActiveX.  
  ActiveX    -,  
 ActiveX,   ActiveX,     
 OLE.        , 
 Internet Explorer, Delphi, C++, Visual Basic  IntraBuilder. 

          

    Delphi           
 .   3     
      . 

       

          Delphi  
-           
Borland (Borland Database Engine,  BDE),     
  ,      BDE, 
        BDE. Delphi 3 
    ,    
      /, .. - 
         . 
         
 ,     TMemoryDataSet.  
     BDE,    
 .         
     , ,  
  ,  bl, TQuery  ,  ,   
 ,      . 

      TDataSet 

            
   TDataSet      DB  DBTABLES. 
,     BDE,     TDataSet   
TBDEDataSet    DB   DBTABLES. 

     1.    Delphi 3 17 


       

           Borland (BDE)   
   FoxPro  Access.    OLE  
    BDE. 

     Database Explorer 

    Database Explorer   DB2  Informix.   
   SQL, ,     
,  Oracle   Interbase,     
.    Database Explorer  Delphi,   
  SQL    . Delphi 
         
      Database Explorer    
 ,     (Form Designer),  
    TStoredProc.    Database 
Explorer    12, "   ". 

          

          . 

      Delphi 

     2, "  Delphi",     
  (Integrated Development Environment  IDE).    
    ,       
.       ,  
  :   (Object Inspector),  
 (Code Editor)    (Form Designer).   ,  
 ,    ,      
   Delphi.      
 (Project Manager)    (Object Repository)   
,     . 

     Object Pascal 

     Object Pascal     Delphi-. 
      3, "Object Pascal:  ",  "" Delphi, 
    ,   ""    
       Object 
Pascal,    ,    
  .       " 
"   ,      
   ,      
  ,    ,    
 ,  ,   . 
       4, "Object Pascal:  ",    
    Object Pascal   - 
.  ,     ,  
      " " ,  
  Delphi. 

         

     5, "  ",   
    .    
 try. . .except  try. . . finally,  ,    
 ,     . 

        

      (Component Library)     
      "" Delphi.     
         
 . 

    18  I.   

      6, "  Delphi",  ,   
       . 
        ,  
        . 
     7, "   Win32",    
 ,    (iconic list)   
- (segmented progress bar),  ""    
  Windows 95.  ,      
 ,  TCoolBar, TToolBar  TAnimate.  
          . 

      

      8, " ",  ,   
 .        
 TForm      . 
" ",         
 (Single Document Interface),    
(Multiple Document Interface)   (Console).     
    ,     
     (API). " 
"         
   . 

       

    Delphi     " "  
  ,        
.            
Borland (Borland Database Engine,  BDE).     
    . 
      9, "    ",    
      ,  ,   ,  
        : Paradox  
dBASE.       Delphi  BDE    
 BDE,       . 
       10, "    SQL",   ,  
    9,       
  (SQL),   SQL   SQL,   
     SQL  .    
 SQL- ,  TStoredProc  TUpdateSQL,  
     (VCL).    
    BDE,     
   SQL. 
          11, "     ",  
    ,    Delphi,    
Database Explorer, Data Dictionary  SQL Monitor.     
            
    . 
          12, "  ",     
       Delphi 3   
 Quick Reports 2.0   ,      
(Quick Reports Wizard)    (Report Template)   
 ,       . 
         13, "   ",   
      Delphi TDataSet. 
 TDataSet     Delphi,   Delphi  
,        . 
   ,    ,  
     ,  "", 
     ASCII-    , 
    BDE. 
          14, "  ",   
,        Delphi 3 
    ,  ,    
   Web-. 

     1.    Delphi 3 19 


        

      Delphi      
         . 
      15. "  ",     
  Delphi.  ,    ,     
,       . 
       16, " "',    
 .  ,  ,   
  .       ,  
       ,  
          
  (Component Palette). , ,      
     . 
      17, " ",   , 
   16,           
  .  ,     
,      ,   
          . 

    OLE  ActiveX 

          Microsoft (Object Linking 
and Embedding,  OLE)       
   ,      
 . ActiveX     " " 
 OLE,       
 Internet.         
OLE  ActiveX,       
-    .  
? ,  ,     Web-? 
  , ""      . 
          18, "  OLE,      
ActiveX",  ,  ,     OLE  
      ,       
    .  ,       
  ,    OLE.  
    ActiveX      OLE. 
      19, "   ",     
 Component Object Model ().     
-,       ,    
  .       ,     
     Delphi   Delphi 
ActiveX (DAX),     -.  
    DAX   -, 
  Context Menu Shell Extension  Windows 95  Windows NT 4.0. 
          20, " OLE",  ,     
   OLE   .    
    OLE,     
     OLE-,   
 ( Visual Basic  Microsoft)     
Delphi   OLE. 
      21, "   ActiveX",   
  ActiveX  Active-     Delphi 
ActiveX (DAX).     DAX  Web-, 
   Web- Microsoft Internet Explorer. 

       

    Delphi   ,     
  Windows (Graphics Device Interface,  GDI)   
       .     
  . 

    20  I.   

        22, "  ",     
 Delphi,      ,  
TCanvas, TPen  TBrush,      GDI  
. 
        23, "  Delphi",    GDI  Delphi, 
      .   , 
    ,        
.  ,         
 ,    .  ,   
        ,   
    .         
  TPrinter  ,       
 . 

      

           Win32  
.   24, "  "',  ,   
 ,   ,     
   .  ,     
  ( , ,   ) 
   .        
,       .   
  ""     Win32,    
   Delphi    TThread. 

      DLL 

       (Dynamic Link Library,  DLL)  
      Windows.   
,     ,    
    .  DLL 
   . 
         25, " DLL: ",    
   DLL,       
      Win16    Win32.  
,    DLL,     
  ,     Delphi  
DLLMain. 
         26, " DLL:  ",   
,    25,      
 DLL.   ,     DLL   
     .   
    Turbo Dump,      
        . 

       

     ,           
,      . ,    
    ,     
 .   27, "  ",   
 Delphi,         
.        
,         
  Delphi (Integrated Debugger).   ,  
  ,     
,        
.   ,    ""  
     , ,     , 
 - . 

      Internet 

      28, "   Web-",   
   ,     Internet.  
   ,    , 
    Internet,   ,   
    Web.      
 Web-,        
,    ,   ISAPI.  
,      ,    
     VCL,     
Internet. 

     1.    Delphi 3 21 


      IDE 

       (IDE)     
.       Open Tools API. 
 29, "   Open Tools API",  , 
  API.  ,      
IDE.         
( , ,    ),  
 ,      ,  
      . 

      C++ 

     Delphi      ( 
 OBJ),       
     (,   C++).   30. 
" Delphi  C++",    ,    C++  
Delphi     DLL.    
      ,    , 
    C++  Delphi. 

       

         Delphi,    
 ,      .    
 Win32 API   16- ,    
  . 
         31, "   Windows API",   
 ,     API,  
  Windows API,      
.        :    
""   Delphi WINDOWS.PAS    
,      32- . 
,   ,     PlayKeys   
   Windows     (callback 
functions).      
        
 Windows. 
          32, "  ",    
(thanking),      API,   
    .       
           
  Win32,  QTThunk. 

     

     ,         
.         . 
         ,             , 
     Delphi  ( , 
  ).   , -,   
 ( ,         
  )     - 
,       . -,    
         (  
 ,   ,  ,      
,   ..       
    "  ",  ,   
   .  . .). 
              . 

    22  I.   


     

     ,       Delphi,   
       
.    ,    
    ,    , 
     .    : 

    {          . } 
    if  VisualBasicInstalled and DelphiHasNotBeenUsed  then 
		ShowMessage('The men in white coats will be along shortly'); 

            
(     ). ,   
     ,   
        
(,   ).    ,  
       ,   
   . 

     

      "" (   -)  
          ,  
  ,   "   ".        
 ? 
     Delphi         
    (IDE), - 
,  ,  OLE  ActiveX, ,  
,        . 
       ,  Delphi 3: 
  ,    (Visual 
Component Library,  VCL),    (Runtime 
Library,  RTL)  .        
          Borland 
(Borland Database Engine,  BDE). 
         ,    (  
       ,      ). 
              
  Delphi 3.  ! 

     1.    Delphi 3 23 

