请问如何封闭窗体中ALT+F4的关闭功能?多谢!

解决方案 »

  1.   

    procedure TForm1.FormPress(...)
    begin
      if key=chr(VK_F4) and (ssAlt in shit) then 
        exit;
    end;
      

  2.   

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

  3.   

    但是如果有其他的控件在form上的话,而且焦点在它上面,上面的方法就不行了,难道要一个一个编写 keydown 事件?
      

  4.   

    不知你要作什么,如果不想让人关窗口,在form.onCloseQuery中设置CanClose:= False;就可以了
      

  5.   

    不知你要作什么,如果不想让人关窗口,在form.onCloseQuery中设置CanClose:= False;就可以了再问: 如果此时写close语句,管用不??
      

  6.   

    写在closequery事件中,只要关闭close就触发该事件。
    procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
    canclose:=false;
       if application.messagebox
    ('是否要?','退',MB_YESNO+mb_iconinformation)=idyes then
               canclose:=true;
    end
      

  7.   

    to orber(破烂的) 
    把FORM的KEYPREVIEW打开