home *** CD-ROM | disk | FTP | other *** search
/ Delphi 4 Bible / Delphi_4_Bible_Tom_Swan_IDG_Books_1998.iso / source / SysMenu / Main.pas < prev    next >
Pascal/Delphi Source File  |  1998-02-12  |  1KB  |  51 lines

  1. unit Main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Label1: TLabel;
  12.     procedure FormCreate(Sender: TObject);
  13.   private
  14.     procedure WMSysCommand(var Message: TWMSysCommand);
  15.       message wm_SysCommand;
  16.     { Private declarations }
  17.   public
  18.     { Public declarations }
  19.   end;
  20.  
  21. var
  22.   Form1: TForm1;
  23.  
  24. implementation
  25.  
  26. const
  27.   cm_About = $00A0;  { Define a constant for the new command }
  28.  
  29. {$R *.DFM}
  30.  
  31. { Respond to selection of our new system menu command }
  32. procedure TForm1.WMSysCommand(var Message: TWMSysCommand);
  33. begin
  34.   case Message.CmdType of
  35.     cm_About: ShowMessage('About command selected!');
  36.   else
  37.     inherited;  { Default processing }
  38.   end;
  39. end;
  40.  
  41. {Add a command to the window's system menu }
  42. procedure TForm1.FormCreate(Sender: TObject);
  43. var
  44.   MenuH: HMenu;
  45. begin
  46.   MenuH := GetSystemMenu(Handle, False);
  47.   AppendMenu(MenuH, mf_String, cm_About, 'About...');
  48. end;
  49.  
  50. end.
  51.