1、
procedure TForm1.WMInit(var msg: TWMInitMenuPOPUP);
begin
inherited;
EnableMenuItem(msg.MenuPopup ,sc_Close,MF_BYCOMMAND or MF_GRAYED)
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
PostMessage(handle, WM_INITMENUPOPUP, GetSystemMenu(handle, false), 0);
end;
2、
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := CaNone;
end;
3、
procedure TForm2.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose:=false;
end;
4、
bordericons的bisystemmenu:=false;
5、
TForm1 = class(TForm)
private
procedure Sys(var msg: TMessage);message WM_SYSCOMMAND;
public
{ Public declarations }
end;
procedure TForm1.Sys(var msg: TMessage);
begin
if msg.WParam = SC_CLOSE then
msg.Result := 1;
end;
6、
procedure WMInit(var msg: TWMInitMenu);message WM_INITMENU;
procedure TForm1.WMInit(var msg: TWMInitMenu);
begin
inherited;
EnableMenuItem(msg.Menu,sc_Close,MF_BYCOMMAND or MF_GRAYED)
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
PostMessage(handle, WM_INITMENU, GetSystemMenu(handle, false), 0);
end;
Delphi中让窗口关闭按钮无效的6种方法
最新推荐文章于 2022-06-20 10:26:30 发布