When delphi trayIcon controls, how to minimize the window to the system tray

type
  TForm1 = class(TForm)
  private
    procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
  end;
 
  ......
   
Procedure TForm1.WMSysCommand ( var Msg: TWMSysCommand);
 the begin 
  Inherited ;
   IF Msg.CmdType = SC_MINIMIZE the then  // window receives a message minimize 
  the begin 
    Application.Minimize; // minimization procedure 
    the ShowWindow (Application.Handle, SW_HIDE); // hide the taskbar icon 
  End ;
 End ;

Remember Restore window, click or double-click the event TrayIcon, otherwise you can not see the program, can only use Task Manager to end.

 

Application response to the news event, and if the message is displayed minimized icon, hide the main window and the Application.

Guess you like

Origin www.cnblogs.com/jijm123/p/12602683.html