那个close到底是怎么执行的呢?
现在有个问题很迷惑,有两个Form是程序自动创建的,其中一个是主窗口,一个是MyForm
现在这个MyForm我点击close时,在出窗口MyForm.show也能显示,很奇怪。但程序经常出现个著名的异常,好像是叫违犯规则冲突异常?
close事件我什么也没有写。

解决方案 »

  1.   

    type
      TForm1 = class(TForm)
      private
         procedure WMSysCommand(var Message: TWMSysCommand);message WM_SYSCOMMAND;
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.WMSysCommand(var Message: TWMSysCommand);
    begin
      if Message.CmdType = SC_CLOSE  then
      begin
         showmessage('你点了X按钮');            ////自己写要达到的效果
      end else
          begin
            inherited;
          end;
    end;