home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 26 / CD_ASCQ_26_1295.iso / vrac / picdll.zip / TESTEM.PAS < prev    next >
Pascal/Delphi Source File  |  1995-06-16  |  3KB  |  100 lines

  1. unit Testem;
  2.  
  3. { Program copyright (c) 1995 by Charles Calvert }
  4. { Project Name: RUNDLL }
  5.  
  6. { RunDLL is an excerpt from Delphi Programming Unleashed, a SAMS book. }
  7.  
  8. { This is an example program showing how to create and call DLLs in Delphi.
  9.   
  10.   This program will test FRACTDLL and APIDLL. FRACTDLL has Delphi forms
  11.   stored in it, APIDLL, creates windows by directly calling
  12.   the Windows API.
  13.  
  14.   You must compile and link FRACTDLL and APIDLL before
  15.   running this program. }
  16.  
  17. interface
  18.  
  19. uses
  20.   SysUtils, WinTypes, WinProcs,
  21.   Messages, Classes, Graphics,
  22.   Controls, Forms, Dialogs,
  23.   StdCtrls, DLLUnit, Buttons;
  24.  
  25. type
  26.   TBigNumber = class(TForm)
  27.     CreateChild: TBitBtn;
  28.     AboutDLL: TBitBtn;
  29.     Pictures: TBitBtn;
  30.     Fern: TBitBtn;
  31.     Squares: TBitBtn;
  32.     Start: TBitBtn;
  33.     RegPopup: TBitBtn;
  34.     CreatePopup: TBitBtn;
  35.     procedure StartClick(Sender: TObject);
  36.     procedure PicturesClick(Sender: TObject);
  37.     procedure AboutDLLClick(Sender: TObject);
  38.     procedure CreateChildClick(Sender: TObject);
  39.     procedure RegPopupClick(Sender: TObject);
  40.     procedure CreatePopupClick(Sender: TObject);
  41.   private
  42.     DLLWnd: HWnd;
  43.   end;
  44.  
  45. var
  46.   BigNumber: TBigNumber;
  47.  
  48. implementation
  49.  
  50. {$R *.DFM}
  51.  
  52. { Call Delphi forms stored in a DLL }
  53. procedure TBigNumber.PicturesClick(Sender: TObject);
  54. begin
  55.   case (Sender as TBitBtn).Tag of
  56.     100: ShowPictures(Application.Handle);
  57.     101: ShowSquares(Application.Handle);
  58.     102: ShowFerns(Application.Handle);
  59.   end;
  60. end;
  61.  
  62. { Show the About Box from the APIDLL }
  63. procedure TBigNumber.AboutDLLClick(Sender: TObject);
  64. begin
  65.   ShowAbout(Handle);
  66. end;
  67.  
  68. { This routine registers and shows a child window. It
  69.   can only be called once during the run of the program.
  70.   It calls routines from APIDLL.}
  71. procedure TBigNumber.StartClick(Sender: TObject);
  72. begin
  73.   RegisterChild(Handle);
  74.   Start.Enabled := False;
  75. end;
  76.  
  77. { This routine creates and runs a child window
  78.   It calls routines from APIDLL}
  79. procedure TBigNumber.CreateChildClick(Sender: TObject);
  80. begin
  81.   DLLUnit.CreateChild(Handle);
  82. end;
  83.  
  84. { This routine registers and shows a Popup window. It
  85.   can only be called once during the run of the program.
  86.   It calls routines from APIDLL. }
  87. procedure TBigNumber.RegPopupClick(Sender: TObject);
  88. begin
  89.   RegisterWinPopup;
  90.   RegPopup.Enabled := False;
  91. end;
  92.  
  93. { Create a popup window. Calls APIDLL }
  94. procedure TBigNumber.CreatePopupClick(Sender: TObject);
  95. begin
  96.   CreateWinPopup;
  97. end;
  98.  
  99. end.
  100.