Jump to content

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

[How To] Set a GUI to be " Always at Bottom"


  • Please log in to reply
4 replies to this topic
SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

How to set a GUI to be " Always @ Bottom " ?
http://www.autohotke...p?p=54403#54403

I might be technically incorrect - but in layman terms,
"Always On Top" window will never be below any other window - and
"Always At Bottom" window will never be above any other window
because its a "Child window" of the Desktop.

The "sticking of the GUI" is achieved by a DllCall to User32.dll function "SetParent"
which sets the GUI to be the child window of Desktop.

Reference / Credits

Well. I was never comfortable with DllCall(), but for evl & Serenity ( & others ) who helped me to understand this
particular function on Ask for Help topic : Is there a way to write "Text" on Desktop, above Wallpaper ?

You may view Serenity's Post.
evl has posted it in Script & Functions titled : SetParent function (make a gui belong to another window).

I was hesitant in posting this but I had already written a demo ...

Always @ Bottom - How to ?

Add the following line immediately after Gui, Show

WinSet:=AlwaysAtBottom(WinExist("A"))

and include the AlwaysAtBottom() function in your script

AlwaysAtBottom(Child_ID)
 {
  WinGet, Desktop_ID, ID, ahk_class Progman
  Return DllCall("SetParent", "uint", Child_ID, "uint", Desktop_ID)
 }

and thats it .... :D

The use?

You can make a GUI - a ToolWindow - without a Title bar - exactly the size of your desktop -
make this GUI always @ bottom - add small pictures to it - associate programs to these pictures
with gLabel - and what not ? This GUI will not be minimizeable and desktop will not be accessible
till this GUI is closed. A VIRTUAL DESKTOP ?

The Demo!

Posted Image<O>Posted Image

Seen above is a small timer-based clock that will be stuck on Desktop.
I have applied the "Shadowed Text" effect that I have explained in my previous post.

You may download the Demo : DT_Clock.ahk or View the code : DT_Clock.ahk.txt.


Added: 30-Jun-2006

More efficient way of setting a GUI to be the "Child window of Desktop"

Credit: Enhancement suggested by evl on next post.

Just add these two lines in the beginning when coding a GUI:

Gui, +Lastfound
DllCall("SetParent", UInt, WinExist() , UInt, WinExist("Program Manager"))

.. and that would suffice !

Copy / Paste / Try Example:
Gui, +Lastfound
DllCall("SetParent", UInt, WinExist() , UInt, WinExist("Program Manager"))
Gui, Show, w400 h300, This GUI is a Child Window of Desktop
Return

GuiClose:
GuiEscape:
ExitApp
Return



evl
  • Members
  • 1237 posts
  • Last active: Oct 20 2010 11:41 AM
  • Joined: 24 Aug 2005
Nice, I hadn't tried to use window id's directly in my function, but I'll update my post with another example because it's even simpler this way.

Btw, it is more reliable to use something like the code below (one of Chris' tricks) to get the ID of the gui - this can be done even before showing the Gui 8) :

Gui, %Gui_Number%: +LastFound
Gui_ID := WinExist()


SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Dear evl, :)

Btw, it is more reliable to use something like the code below (one of Chris' tricks) to get the ID of the gui - this can be done even before showing the Gui 8) :

Gui, %Gui_Number%: +LastFound
Gui_ID := WinExist()


Thanks for posting it, I did not notice it :oops:.

Regards, :)

jjjames
  • Members
  • 36 posts
  • Last active: Feb 18 2013 09:26 PM
  • Joined: 09 Aug 2009
Can't get "Always At Bottom" working. To me it seems just like any regular GUI window and isn't "stuck" below everything else. I downloaded your clock sample and it's not always at bottom.

Does the script need an update?

thanks anyhow...lot's of VERY useful scripts!

meochain
  • Members
  • 12 posts
  • Last active: Jun 10 2012 04:25 PM
  • Joined: 10 Jun 2012
Its Really nice information...Thanks for Sharing