home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September / Chip_2002-09_cd1.bin / zkuste / delphi / experti / d45 / FRMWIZRD.ZIP / LKDemoForms.pas < prev    next >
Pascal/Delphi Source File  |  2002-05-30  |  851b  |  43 lines

  1. unit LKDemoForms;
  2.  
  3. interface
  4.  
  5. uses Classes, Forms, Messages, Windows;
  6.  
  7. type
  8.     //Testdescendant of TForm: Adds the published boolean property "MinimizesApp".
  9.   // When set to TRUE, minimizing this form mimimizes the entire Application.
  10.     TLKDemoForm = class(TForm)
  11.     private
  12.         fMinApp: Boolean;
  13.         procedure SetMinApp(Value: Boolean);
  14.         procedure WMSysCommand(var Msg: TMessage); message WM_SysCommand;
  15.     public
  16.     published
  17.         property MinimizesApp: Boolean read fMinApp write SetMinApp;
  18.     end;
  19.  
  20.  
  21.  
  22. implementation
  23.  
  24.  
  25. procedure TLKDemoForm.SetMinApp(Value: Boolean);
  26. begin
  27.     fMinApp := Value;
  28. end;
  29.  
  30. procedure TLKDemoForm.WMSysCommand(var Msg: TMessage);
  31. begin
  32.     if fMinApp and ((Msg.wParam = SC_MINIMIZE) or (Msg.wParam = SC_ICON)) then
  33.     begin
  34.         Application.Minimize;
  35.         Msg.Result := 1;
  36.     end
  37.     else
  38.         inherited;
  39. end;
  40.  
  41.  
  42. end.
  43.