Hide /show taskbar clock

Simple function to show and hide taskbar clock.

procedure ShowClock(show: boolean);
var TrayWnd, TrayNWnd, ClockWnd : Hwnd;
begin
  TrayWnd  := FindWindow('Shell_TrayWnd', nil);
  TrayNWnd := FindWindowEx(TrayWnd,0, 'TrayNotifyWnd', nil);
  ClockWnd := FindWindowEx(TrayNWnd,0, 'TrayClockWClass', nil);
  if show then ShowWindow(ClockWnd,sw_show)
          else ShowWindow(ClockWnd,sw_hide)
end;

Leave a Reply