but on my computer, there's still the annoying color around the clock.
Code: Select all
; VistaClock II by netmaestro, 2006
; Written for Purebasic 4.0+
EnableExplicit
Macro MoveWindow(window)
ReleaseCapture_()
SendMessage_(WindowID(window), #WM_NCLBUTTONDOWN, #HTCAPTION, #Null)
EndMacro
Macro SizeWindow(window, bool)
If bool
SetWindowLong_(WindowID(window), #GWL_STYLE, GetWindowLong_(WindowID(window), #GWL_STYLE) | #WS_SIZEBOX)
Else
SetWindowLong_(WindowID(window), #GWL_STYLE, GetWindowLong_(WindowID(window), #GWL_STYLE) & ~#WS_SIZEBOX)
EndIf
SetWindowPos_(WindowID(window), 0, 0, 0, 0, 0, #SWP_NOMOVE | #SWP_NOSIZE | #SWP_NOZORDER | #SWP_FRAMECHANGED)
EndMacro
Macro AlphaWindow(window, color, alpha)
SetWindowLong_(WindowID(window), #GWL_EXSTYLE, GetWindowLong_(WindowID(window), #GWL_EXSTYLE) | #WS_EX_LAYERED)
SetLayeredWindowAttributes_(WindowID(window), color, ((alpha)*255)/100, #LWA_COLORKEY | #LWA_ALPHA)
EndMacro
#color = #White
If ExamineDesktops() And OpenWindow(0, 0, 0, 80, 80, "VistaClock", #PB_Window_ScreenCentered|#PB_Window_BorderLess|#PB_Window_Invisible)
StickyWindow(0, #True)
SetWindowColor(0, #color)
AlphaWindow(0, #color, 50)
If CreateGadgetList(WindowID(0))
VistaClockGadget(0, 0, 0, WindowWidth(0), WindowHeight(0), #color, #True)
EndIf
If CreatePopupMenu(0)
MenuItem(0, "VistaClock")
DisableMenuItem(0, 0, #True)
MenuBar()
OpenSubMenu("Alpha...")
MenuItem(1, "25%")
MenuItem(2, "50%")
MenuItem(3, "75%")
MenuItem(4, "100%")
CloseSubMenu()
OpenSubMenu("Resize...")
MenuItem(5, "50px")
MenuItem(6, "75px")
MenuItem(7, "100px")
MenuItem(8, "125px")
MenuItem(9, "150px")
MenuBar()
MenuItem(10, "Set...")
CloseSubMenu()
OpenSubMenu("Position...")
MenuItem(11, "Up Left")
MenuItem(12, "Up Right")
MenuBar()
MenuItem(13, "Bottom Left")
MenuItem(14, "Bottom Right")
CloseSubMenu()
MenuBar()
MenuItem(15, "Sticky")
SetMenuItemState(0, 15, #True)
MenuBar()
MenuItem(16, "Exit")
EndIf
HideWindow(0, #False)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_SizeWindow
ResizeGadget(0, 0, 0, WindowWidth(0), WindowHeight(0))
Case #PB_Event_Gadget
Select EventType()
Case #PB_EventType_LeftClick
MoveWindow(0)
Case #PB_EventType_RightClick
DisplayPopupMenu(0, WindowID(0))
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case 1: AlphaWindow(0, #color, 25)
Case 2: AlphaWindow(0, #color, 50)
Case 3: AlphaWindow(0, #color, 75)
Case 4: AlphaWindow(0, #color, 100)
Case 5: ResizeWindow(0, #PB_Ignore, #PB_Ignore, 50, 50)
Case 6: ResizeWindow(0, #PB_Ignore, #PB_Ignore, 75, 75)
Case 7: ResizeWindow(0, #PB_Ignore, #PB_Ignore, 100, 100)
Case 8: ResizeWindow(0, #PB_Ignore, #PB_Ignore, 125, 125)
Case 9: ResizeWindow(0, #PB_Ignore, #PB_Ignore, 150, 150)
Case 10: SetMenuItemState(0, 10, #True - GetMenuItemState(0, 10))
SizeWindow(0, GetMenuItemState(0, 10))
Case 11: ResizeWindow(0, 25, 25, #PB_Ignore, #PB_Ignore)
Case 12: ResizeWindow(0, DesktopWidth(0) - WindowWidth(0) - 25, 25, #PB_Ignore, #PB_Ignore)
Case 13: ResizeWindow(0, 25, DesktopHeight(0) - WindowHeight(0) - 25, #PB_Ignore, #PB_Ignore)
Case 14: ResizeWindow(0, DesktopWidth(0) - WindowWidth(0) - 25, DesktopHeight(0) - WindowHeight(0) - 25, #PB_Ignore, #PB_Ignore)
Case 15: SetMenuItemState(0, 15, #True - GetMenuItemState(0, 15)) : StickyWindow(0, GetMenuItemState(0, 6))
Case 16: Break
EndSelect
EndSelect
ForEver
EndIf
End