alt+f4会触动sys_command消息。
所以可以这么写代码:
TForm1 = class
...
procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
end;procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
begin
if Msg.CmdType <> SC_CLOSE then
inherited
end;
所以可以这么写代码:
TForm1 = class
...
procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
end;procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
begin
if Msg.CmdType <> SC_CLOSE then
inherited
end;
begin
if key=115 then key:=0;
end;
这样就行啦!!!!!!!!!