屏蔽Alt+F4

解决方案 »

  1.   

    procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState);
    begin
    if (ssAlt in shift)and(key=115) then key:=0;
    end;
      

  2.   

    TForm1 = class
    ...
    private
    procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
    ...end;procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
    begin
      if Msg.CmdType <> SC_CLOSE then
        inherited
    end;
      

  3.   

    详细一点:
    type
      TForm1 = class(TForm)后,Private前面写:
    procedure SysCommand(var msg:TWMSysCommand);message WM_SysCommand;实现;
    procedure TForm1.SysCommand(var msg: TWMSysCommand);
    begin
      if msg.CmdType = SC_CLOSE then
      begin
        msg.cmdtype:= SC_DEFAULT;
        Hide;
      end;
      inherited;
    end;
      

  4.   


    if (ssAlt in shift)and(key=115) then key:=0;同意……