VB Code:
Dim tmpWnd&
tmpWnd = FindWindow("Shell_TrayWnd", "") 'Task bar
tmpWnd = FindWindowEx(tmpWnd, 0&, "TrayNotifyWnd", "") 'System tray
trayClock = FindWindowEx(tmpWnd, 0&, "TrayClockWClass", "") 'System tray clock
However, when I added to it to look like the following:
VB Code:
Dim tmpWnd&, clsName As String * 100, clsLen&
tmpWnd = FindWindow("Shell_TrayWnd", "") 'Task bar
tmpWnd = FindWindowEx(tmpWnd, 0&, "TrayNotifyWnd", "") 'System tray
trayClock = FindWindowEx(tmpWnd, 0&, "TrayClockWClass", "") 'System tray clock
If trayClock = 0 Then
tmpWnd = GetWindow(tmpWnd, GW_CHILD)
Do While tmpWnd <> 0
clsLen = GetClassName(tmpWnd, clsName, 100)
If Left(clsName, clsLen) = "TrayClockWClass" Then
trayClock = tmpWnd
Exit Do
End If
tmpWnd = GetWindow(tmpWnd, GW_HWNDNEXT)
Loop
End If
it works just fine. In fact, the first child of TrayNotifyWnd (the system tray) is the SysTray clock. Any idea why the first didn't work? (P.S. trayClock is a Public variable and I'm 100% positive that the SysTray clock's class name is TrayClockWClass, thanks to a "WindowSpy" example program I have)