Link to home
Start Free TrialLog in
Avatar of codeconqueror
codeconqueror

asked on

Hiding the System Clock on the fly

Does anyone know how to hide the system clock in the taskbar in 2000/XP?  I know about the registry entries at:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\HideClock
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\HideClock
HKEY_CURRENT_USER\Control Panel\don't load\timedate.cpl


And I modify them correctly and if I log out and back in, it works.  But I need this to happen on the fly.  I am already modifying several other Windows rights (access desktop, start button, etc...) and am using GPUPDATE (XP, SECEDIT for 2K) to update the policy and this works for everything I'm doing except the system clock.  When I go the taskbar properties and disable the clock, it happens immediately.  How can I get this to happen immediately like that?  Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Leo Eikelman
Leo Eikelman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of codeconqueror
codeconqueror

ASKER

Thanks, trying that and testing right now.  Will post back in a bit with results.
That worked perfectly.  I made an additional modification because it hid the clock, but the area was still there and could be double clicked and open the date/time settings.  Here is the ammended code in case anyone after me is trying to do this as well:

<CODE SNIPPET>
Private Sub HideClock()
Dim FindClass As Long, FindParent As Long, Handle As Long
FindClass& = FindWindow("Shell_TrayWnd", vbNullString)
FindParent& = FindWindowEx(FindClass&, 0, "TrayNotifyWnd", vbNullString)
Handle& = FindWindowEx(FindParent&, 0, "TrayClockWClass", vbNullString)
EnableWindow Handle&, False '**** This is the line I added
ShowWindow Handle&, 0
End Sub

Private Sub ShowClock()
Dim FindClass As Long, FindParent As Long, Handle As Long
FindClass& = FindWindow("Shell_TrayWnd", vbNullString)
FindParent& = FindWindowEx(FindClass&, 0, "TrayNotifyWnd", vbNullString)
Handle& = FindWindowEx(FindParent&, 0, "TrayClockWClass", vbNullString)
EnableWindow Handle&, True '**** This is the line I added
ShowWindow Handle&, 1
End Sub
</CODE SNIPPET>

Thanks for the quick help.  You rock.  :)
Thanks :)

Leo