AutoHotkey Community

It is currently May 27th, 2012, 7:17 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: March 27th, 2006, 11:16 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Quote:
How to set a GUI to be " Always @ Bottom " ?
http://www.autohotkey.com/forum/viewtopic.php?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

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


and include the AlwaysAtBottom() function in your script

Code:
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!

Image<O>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.


Quote:
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:

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


.. and that would suffice !

    Copy / Paste / Try Example:
Code:
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




Last edited by SKAN on June 16th, 2008, 7:24 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2006, 11:50 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
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) :

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 28th, 2006, 9:55 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Dear evl, :)

youl wrote:
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) :

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


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

Regards, :)


Last edited by SKAN on June 16th, 2008, 7:24 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2009, 7:18 am 
Offline

Joined: August 9th, 2009, 9:27 am
Posts: 35
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!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group