disable the X button

hi all can anyone tel me how I can disabled the X button on my program so if so one press's it, it will not close program?

thanks hope you all are going to have a good new year :)
Slewis

Comments

  • : hi all can anyone tel me how I can disabled the X button on my program so if so one press's it, it will not close program?
    :
    : thanks hope you all are going to have a good new year :)
    : Slewis
    :
    I'm not sure how to do that, but you can trap the OnClose message, put up a dialog box to make sure they intend to close, and only close if they answer in the affirmative. You can abort the Close by setting the Action parameter to caNone.
  • thanks mate but I work it out you can use

    [code]
    procedure Tfrmadban.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
    CanClose := False;
    end;
    [/code]

    stops it :)
    Slewis

  • : thanks mate but I work it out you can use
    :
    : [code]
    : procedure Tfrmadban.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    : begin
    : CanClose := False;
    : end;
    : [/code]
    :
    : stops it :)
    : Slewis
    :
    :
    Yep. That message fires before the OnClose. Both work.
  • Hi.

    If you override the CreateParams() of the Form, then you can include ??_NOCLOSE option. I don't know if it it WM_ or CM_ but you can probably find it in the OLH. Sorry, but I do not have access to Delphi here. If I find it I will reply to this message again.

    hth, pritaeas.

    : hi all can anyone tel me how I can disabled the X button on my
    : program so if so one press's it, it will not close program?
  • It should be CS_NOCLOSE

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories