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\C urrentVers ion\Polici es\Explore r\HideCloc k
HKEY_LOCAL_MACHINE\Softwar e\Microsof t\Windows\ CurrentVer sion\Polic ies\Explor er\HideClo ck
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.
HKEY_CURRENT_USER\Software
HKEY_LOCAL_MACHINE\Softwar
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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. :)
<CODE SNIPPET>
Private Sub HideClock()
Dim FindClass As Long, FindParent As Long, Handle As Long
FindClass& = FindWindow("Shell_TrayWnd"
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"
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
Leo
ASKER