Board index » delphi » Disabling "close window" button

Disabling "close window" button

In D3, how do I disable the "close window" button in the top right corner
of the window?

Thanks in advance

Bent

 

Re:Disabling "close window" button


Well . . .

You can't actually make it disappear unless you play with thte border
icons, basically setting to 'nothing';

However,if you want it to appear, nicer, but yet stop it from working.

Have a boolean in your program, say

  var   ShutdownFlag:Boolean;

in formcreate, set it to false;

then when user clicks on the button or whatever to exit the program, you
set it to true;

now.. the trick is in the OnCloseQuery Event;

the CanClose flag determines if the application should terminate.

So, you add the following code:

    CanClose:=ShutDownFlag;

That's all.. it should fulfill your goal nicely.

Regards,
  Joe

Re:Disabling "close window" button


Quote
Bent Jensen wrote in message <01bd7e57$137c2700$6cc90059@bent>...
>In D3, how do I disable the "close window" button in the top right
corner
>of the window?

Try getting the handle of your system menu, and disable the Close Window
item (the ID is probably SC_CLOSE)
--
Zweitze de Vries
zweitze<at>iname<dot>com
When replying, please adjust reply address

Other Threads