Mega Code Archive

 
Categories / Delphi / System
 

Hide the clock in the system tray

Title: hide the clock in the system tray? function ShowTrayClock(bValue: Boolean) : Boolean; var TrayWnd, TrayNWnd, ClockWnd: HWND; begin TrayWnd := FindWindow('Shell_TrayWnd', nil); TrayNWnd := FindWindowEx(TrayWnd, 0, 'TrayNotifyWnd', nil); ClockWnd := FindWindowEx(TrayNWnd, 0, 'TrayClockWClass', nil); Result := IsWindow(ClockWnd); if Result then begin ShowWindow(ClockWnd, Ord(bValue)); PostMessage(ClockWnd, WM_PAINT, 0, 0); end; end; // Example to hide they clock: procedure TForm1.Button1Click(Sender: TObject); begin ShowTrayClock(Boolean(0)); end;