home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / zkuste / delphi / kompon / d3456 / EHS.ZIP / setup.exe / {app} / ehsbase.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-12-16  |  2.4 KB  |  86 lines

  1. { EC Software Help Suite
  2.  
  3.   ⌐ 2000-2002 EC Software. All rights reserved.
  4.  
  5.   This product and it's source code is protected by patents, copyright laws and
  6.   international copyright treaties, as well as other intellectual property
  7.   laws and treaties. The product is licensed, not sold.
  8.  
  9.   The source code and sample programs in this package or parts hereof
  10.   as well as the documentation shall not be copied, modified or redistributed
  11.   without permission, explicit or implied, of the author.
  12.  
  13.  
  14.   EMail: info@ec-software.com
  15.   Internet: http://www.ec-software.com
  16.  
  17.   Disclaimer of Warranty
  18.   ----------------------
  19.  
  20.   THIS SOFTWARE AND THE ACCOMPANYING FILES ARE PROVIDED "AS IS" AND
  21.   WITHOUT WARRANTIES OF ANY KIND WHETHER EXPRESSED OR IMPLIED.
  22.  
  23.   In no event shall the author be held liable for any damages whatsoever,
  24.   including without limitation, damages for loss of business profits,
  25.   business interruption, loss of business information, or any other loss
  26.   arising from the use or inability to use the software. }
  27.  
  28. unit ehsbase;
  29.  
  30. {$I EHS.INC}
  31.  
  32. interface
  33.  
  34. uses
  35.   Windows, Messages, SysUtils, Classes, Controls, Forms;
  36.  
  37. const
  38.   EHS_VERSION = 1.23;
  39.  
  40. type
  41.   TehsBase = class(TComponent)  {base class with window handle}
  42.   private
  43.     fWindowHandle: HWND;
  44.   public
  45.     destructor Destroy; override;
  46.     procedure  Loaded; override;
  47.     procedure  WndProc(var Message: TMessage); virtual;
  48.     property   Handle: HWND read fWindowHandle;
  49.   end;
  50.  
  51. implementation
  52.  
  53. procedure TehsBase.Loaded;
  54. begin
  55.      inherited;
  56.      if (not (csDesigning in ComponentState)) then
  57.      begin
  58.           {$IFDEF EHS_D6_UP}
  59.           fWindowHandle := Classes.AllocateHWnd(WndProc);
  60.           {$ELSE}
  61.           fWindowHandle := AllocateHWnd(WndProc);
  62.           {$ENDIF}
  63.           if fWindowHandle = 0 then raise Exception.create('EHSBase component cannot create window handle.');
  64.      end;
  65. end;
  66.  
  67. destructor TehsBase.Destroy;
  68. begin
  69.      if (not (csDesigning in ComponentState)) and (fWindowHandle <> 0) then
  70.      begin
  71.           {$IFDEF EHS_D6_UP}
  72.           Classes.DeallocateHWnd(fWindowHandle);
  73.           {$ELSE}
  74.           DeallocateHWnd(fWindowHandle);
  75.           {$ENDIF}
  76.      end;
  77.      inherited;
  78. end;
  79.  
  80. procedure TehsBase.WndProc(var Message: TMessage);
  81. begin
  82.      with Message do Result := DefWindowProc(fWindowHandle, Msg, wParam, lParam);
  83. end;
  84.  
  85. end.
  86.