formcreate中写上 SetWindowLong(handle,GWL_STYLE,WS_MINIMIZEBOX);//最小化
procedure TForm1.WMSYSCOMMAND(var Msg: TWMSYSCOMMAND);
begin // 当最小化时,只显示在任务栏
case Msg.CmdType of
SC_CLOSE:
SHOWWINDOW(handle, SW_HIDE); // 关闭
SC_MINIMIZE:
SetWindowLong(handle, GWL_STYLE, WS_MAXIMIZEBOX); // 实现恢复窗口
SC_RESTORE:
SetWindowLong(handle, GWL_STYLE, WS_MINIMIZEBOX); // 实现最小化
end;
if not(Msg.CmdType = SC_CLOSE) then
inherited;
end;