Delphi Form button ashing disable

1. Make the minimize button gray:
setwindowlong(handle,gwl_style,getwindowlong(handle,gwl_style) and not ws_minimizebox);

2. Make the maximize button gray:
setwindowlong(handle,gwl_style,getwindowlong(handle,gwl_style) and not ws_maximizebox);

3. The close button turns gray

EnableMenuItem(GetSystemMenu (Handle, FALSE), SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);

4 Disable ATL+F4

Using the message mechanism to handle the close event

In the tform class Write
procedure wmclose(var msg:tmessage);message wm_close;


..

Then write the specific process
procedure tform1.wmclose (var msg:tmessage)
begin
//
end;
What you want to do when he presses it, you can put it in this process, if you want to continue to close, use
inherited ;

This will block ALT+F4

Leave a Comment

Your email address will not be published.