Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Awesome Desktop Clock


  • Please log in to reply
42 replies to this topic
cjtron
  • Members
  • 34 posts
  • Last active: Jul 25 2011 10:27 PM
  • Joined: 24 Aug 2010

An awesome desktop clock:

Screenshot:

Posted Image

(Background is "Approaching Midnight")

Does not require the GDI+ library, as all needed functions have been inlined.

Download:

<!-- m -->https://ahknet.autoh...Uberi/Clock.ahk<!-- m -->


thanks works !

Cachito
  • Members
  • 11 posts
  • Last active: Sep 27 2011 10:12 AM
  • Joined: 06 Mar 2009
Thanks, Uberi!

Posted Image

Uberi As Guest
  • Guests
  • Last active:
  • Joined: --
Oan: What OS? Which AHK version?

Cachito
  • Members
  • 11 posts
  • Last active: Sep 27 2011 10:12 AM
  • Joined: 06 Mar 2009
Options: Color settings in red

Posted ImagePosted ImagePosted Image

Posted ImagePosted ImagePosted Image

sharethewisdom
  • Members
  • 57 posts
  • Last active: Dec 18 2014 08:44 AM
  • Joined: 24 Feb 2008
hi,
I can't seem to get the GUI to be a child window of the desktop.
;...
OnExit, ExitSub

Gui, 1:-Caption +E0x80000 +LastFound +Owner
[color=red]DllCall("SetParent", UInt, WinExist() , UInt, WinExist("Program Manager"))[/color]
Gui, 1:Show, x%WinX% y%WinY% w515 h515 NoActivate, Clock
hWindow := WinExist()
;...
(the clock is not visible when I reload the script adding the line above colored red)

Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010

DllCall("SetParent","UInt",hWnd,"UInt",WinExist("ahk_class Progman"))

Note that WS_EX_LAYERED cannot be used for child windows


Unfortunately there was no satisfactory solution to parenting the clock to the desktop in the end.

I will update it if it becomes possible though.

tic
  • Members
  • 1934 posts
  • Last active: May 30 2018 08:13 PM
  • Joined: 22 Apr 2007
Does something like this not work?

; Get layered window handle
hwnd1 := WinExist()

DllCall("RegisterShellHookWindow", "uint", hwnd1)
MsgNum := DllCall("RegisterWindowMessage", "str", "SHELLHOOK")
OnMessage(MsgNum, "ShellMessage")
return

ShellMessage(wParam, lParam)
{
	global hwnd1, hwndDesktop
	DllCall("SetWindowPos", "uint", hwnd, "uint", hwndDesktop
	, "int", 0, "int", 0, "int", 0, "int", 0, "uint", 3)
}


Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010
tic:

Thanks for the example. While it isn't perfect (clicking the clock rapidly will still bring it in front of other windows), it's the best solution found so far, and since this feature has been requested a few times now, I have added a ParentDesktop option to the script. Redownload to see the changes.

sharethewisdom
  • Members
  • 57 posts
  • Last active: Dec 18 2014 08:44 AM
  • Joined: 24 Feb 2008

Edit: added parent to desktop option thanks to a suggestion by tic. Enable the ParentDesktop setting to keep the clock parented to the desktop.

did you? :(

(ps: perhaps you could force the gui to reappear when #d is pressed)

Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010
Win + D forces all windows into a hidden state. In my tests, WinActivate, WinSet, and Gui, Show all failed to show the GUI, even after a delay. For now, I assume it isn't doable in any simple way.

You can try Win + M instead, which does show the clock, but it doesn't seem to toggle the windows back when pressed again.

sharethewisdom
  • Members
  • 57 posts
  • Last active: Dec 18 2014 08:44 AM
  • Joined: 24 Feb 2008
I guess a reference to the Improved Show Desktop could be of use here...
(#D is within the handspan on my azerty keyboard and thus more comfortable to toggle)

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
Would you please trim it down and post it to RosettaCode :?:

Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010

I guess a reference to the Improved Show Desktop could be of use here...
(#D is within the handspan on my azerty keyboard and thus more comfortable to toggle)


I prefer #D for the exact same reason (also how it uses toggling). I think anyone who really needs to keep it on the desktop after showing it can use sharethewisdom's script, then.

Would you please trim it down and post it to RosettaCode :?:


Actually, this clock script was made possible due to studying the code behind [b]derRaphael
's Analogue Clock Script. Since all of his/her scripts were released under CC-BY, you should feel free to add that entry into RosettaCode.

To be honest, this script is quite a bit too messy to clean up :D. I think [b]derRaphael
's script is more suitable for inclusion as a demonstration of AHK code.