Replacing system Clock
Replacing system Clock
Hello,
I have written a real cool talking clock. The problem is many users want it to replace there system clock. How do I do it?
THanks
I have written a real cool talking clock. The problem is many users want it to replace there system clock. How do I do it?
THanks
It something to do with the trayclockwclass... If get the handle to it may be I can control it... and even put my clock window inside it! and resize it
but the problem is every example on the internet that say it finds the trayclockwclass returns 0 when I convert it to PB <_< I don't know whats wrong...
Code: Select all
shelltraywnd = FindWindowEx_(0, 0, "shell_traywnd", "");
traynotifywnd = FindWindowEx_(shelltraywnd, 0, "traynotifywnd", "");
trayclockwclass = FindWindowEx_(traynotifywnd, 0, "trayclockwclass", "");Code: Select all
hwndTaskbar.l = FindWindow_("Shell_TrayWnd", "")
hwndTray.l = FindWindowEx_(hwndTaskbar, #Null, "TrayNotifyWnd", "")
hwndClock.l = FindWindowEx_(hwndTray, #Null, "TrayClockWClass", #Null)
Debug hwndClock
If hwndClock
res=ShowWindow_(hwndClock,0)
Debug Res
Delay(4000)
res=ShowWindow_(hwndClock,1)
EndIf SPAMINATOR NR.1
- Rook Zimbabwe
- Addict

- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
How about disabling the Windows Clock (that's easy) and using 2,3, or 4 system tray icons loaded next to each other, each for a character, or 2 characters per tray icon and am/pm in a third icon ?
If you make sure (registry) that the icons are the first ones that get loaded at system startup, you will have your ultimate spot on the right bottom.
Good Luck !
If you make sure (registry) that the icons are the first ones that get loaded at system startup, you will have your ultimate spot on the right bottom.
Good Luck !
Thats not gonna workpureballs wrote:How about disabling the Windows Clock (that's easy) and using 2,3, or 4 system tray icons loaded next to each other, each for a character, or 2 characters per tray icon and am/pm in a third icon ?
If you make sure (registry) that the icons are the first ones that get loaded at system startup, you will have your ultimate spot on the right bottom.
Good Luck !
to retrieve the position of the clock:
Code: Select all
r.rect
GetWindowRect_(hwndClock,r)
Debug r\left
Debug r\top
Debug r\right
Debug r\bottom
w=r\right - r\left
h=r\bottom - r\top
Debug w
Debug hSPAMINATOR NR.1
Code: Select all
hwndTaskbar.l = FindWindow_("Shell_TrayWnd", "")
hwndTray.l = FindWindowEx_(hwndTaskbar, #Null, "TrayNotifyWnd", "")
hwndClock.l = FindWindowEx_(hwndTray, #Null, "TrayClockWClass", #Null)
; Debug hwndClock
; If hwndClock
; res=ShowWindow_(hwndClock,0)
; Debug res
; Delay(4000)
; res=ShowWindow_(hwndClock,1)
; EndIf
If hwndClock
GetWindowRect_(hwndClock, r.RECT)
w=r\right - r\left
h=r\bottom - r\top
OpenWindow(0, r\left, r\top, w, h, "", #PB_Window_BorderLess, hwndTray)
CreateGadgetList(WindowID(0))
TextGadget(0, 0, 0, w, h, "00:00:00", #PB_Text_Center )
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
bit enhanced :
Code: Select all
hwndTaskbar.l = FindWindow_("Shell_TrayWnd", "")
hwndTray.l = FindWindowEx_(hwndTaskbar, #Null, "TrayNotifyWnd", "")
hwndClock.l = FindWindowEx_(hwndTray, #Null, "TrayClockWClass", #Null)
If hwndClock
GetWindowRect_(hwndClock, r.RECT)
w=r\right - r\left
h=r\bottom - r\top
OpenWindow(0, r\left, r\top, w, h, "", #PB_Window_BorderLess, hwndTray)
CreateGadgetList(WindowID(0))
TextGadget(0, 0, 2, w, h, "00:00", #PB_Text_Center )
If LoadFont(1,"MS Sans Serif",8)
SetGadgetFont(0, FontID(1))
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

