unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ComCtrls;

type
  TForm2 = class(TForm)
    RichEdit1: TRichEdit;
    Label1: TLabel;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.DFM}

procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action:=caHide
end;


procedure TForm2.FormCreate(Sender: TObject);
Var SMhandle:Thandle;
       I, id:integer;
begin
  Form2.DoubleBuffered:=true;
  SMhandle:=GetSystemMenu(Self.Handle, false);
  for I:=GetMenuItemCount(SMhandle)-1 downto 0 do
  begin
    id:=GetMenuItemID(SMhandle, I);
    if (id<>SC_CLOSE) and (id<>SC_MOVE) then DeleteMenu(SMhandle, I, MF_BYPOSITION)
  end
end;


end.
