问题原因:遇见---该窗体不是主窗体或窗体未设置正确。
public
procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
procedure TFmain.WMSysCommand;
begin
//取得当最小化时消息,然后将窗体最小化到任务栏
if (Msg.CmdType = SC_MINIMIZE) then
begin
Application.Minimize;
end else
DefaultHandler(Msg);
end;