AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Unoccupiable space?
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guestisism
Guest





PostPosted: Tue Feb 03, 2009 5:44 pm    Post subject: Unoccupiable space? Reply with quote

Okay, I've quickly browsed the forum and help for the answer to this question with no luck.

You know how maximized windows cannot go beyond the Y coordinate of the task bar, right? Well, I am writing a script that sits ontop of the task bar. I need to make it so maximized windows cannot occupy the task bar's Y coordinate - 30.

So I'd imagine I would go...

Code:
WinGetPos, TaskBar_X, TaskBar_Y, TaskBar_Width, TaskBar_Height, ahk_class Shell_TrayWnd
TaskBar_Y -= 30
;And then the code to make that space also unoccupyable, which is what I need help with.


Thank you.
Back to top
Superfraggle



Joined: 02 Nov 2004
Posts: 1019
Location: London, UK

PostPosted: Tue Feb 03, 2009 6:41 pm    Post subject: Reply with quote

If you wanted to do this the correct way, I believe you can register the window as a toolbar, and windows will take care of the rest.

I think I tried this about a year ago, and never got round to finishing, but I am sure its doable.

The other way is to use the shellmessage hook, to see when windows are maximised, and when they are adjust the size appropriately.

Sorry I don't have time to go into more at the moment, hopefully someone else might.
_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Tue Feb 03, 2009 7:46 pm    Post subject: Reply with quote

AppBar: http://www.autohotkey.com/forum/viewtopic.php?p=143640#143640
_________________
URLGet - Internet Explorer based Downloader
Back to top
View user's profile Send private message Send e-mail
Guestisism
Guest





PostPosted: Tue Feb 03, 2009 8:16 pm    Post subject: Reply with quote

How did I know SKAN would come to the rescue? ^^

I've played with your script, SKAN. I got it to register the AppBar. It gets the right height, width, etc. However, I need the AppBar to be at the bottom of the screen (Right on top of the TaskBar). For some reason I can't get it to cooperate.

Sorry. I am most likely just over looking a part in your script.
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Tue Feb 03, 2009 8:39 pm    Post subject: Reply with quote

Guestisism wrote:
I need the AppBar to be at the bottom of the screen (Right on top of the TaskBar). For some reason I can't get it to cooperate.


Taskbar is an AppBar and Windows forbids AppBars mating each other.
If you explain your requirement, maybe I can suggest you alternatives.
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Tue Feb 03, 2009 8:59 pm    Post subject: Reply with quote



I have that Gui grab the TaskBar's Y coordinate, subtract 30 off of it and that is where the Gui sits. Like in the first post.

I guess my wording was bad, I meant I need it directly above (Not on top) of the TaskBar.

I need to register that as an AppBar on the bottom.

I have (Trimmed up alot):

Code:
WinGetPos, TaskBar_X, TaskBar_Y, TaskBar_Width, TaskBar_Height, ahk_class Shell_TrayWnd
Gui_Y_2 := TaskBar_Y - 30
(...)
Gui, 2: -Caption +AlwaysOnTop +ToolWindow +LastFound
Gui_ID_2 := WinExist()
(...)
Gui, 2: Show, x0 y%Gui_Y_2% w%A_ScreenWidth% h30, Tip.It - Main
WinGetPos, GX,GY,GW,GH, ahk_id %Gui_ID_2%
(...)
ABM := DllCall( "RegisterWindowMessage", Str,"AppBarMsg" )
OnMessage( ABM, "ABM_Callback" )
VarSetCapacity( APPBARDATA , 36, 0 )
Off :=  NumPut(  36, APPBARDATA    )
Off :=  NumPut( hAB, Off+0 )
Off :=  NumPut( ABM, Off+0 )
Off :=  NumPut(   1, Off+0 )
Off :=  NumPut(  GX, Off+0 )
Off :=  NumPut(  GY, Off+0 )
Off :=  NumPut(  GW, Off+0 )
Off :=  NumPut(  GH, Off+0 )
Off :=  NumPut(   1, Off+0 )
GoSub, RegisterAppBar
(...)
Etc etc etc.


For some reason it still puts it at the top of the screen.

Ps. The script will be shared when finished. ^^.
Back to top
Guest






PostPosted: Tue Feb 03, 2009 9:12 pm    Post subject: Reply with quote

By "For some reason it still puts it at the top of the screen," I mean it reserves the top area of the screen as an AppBar, yet the Gui is on the bottom of the screen. I need it to reserve 30px above the TaskBar (As seen in my post right before this one).
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Tue Feb 03, 2009 9:42 pm    Post subject: Reply with quote

Try this:

Code:
; Credit: shimanov - www.autohotkey.com/forum/viewtopic.php?p=40066#40066
WinGetPos, GX,GY,GW,GH, ahk_class Shell_TrayWnd
VarSetCapacity( OWA,16,0 ), VarSetCapacity( NWA,16,0 )                   ; SPI_GETWORKAREA
DllCall( "SystemParametersInfo", UInt,0x30, UInt,0, UInt,&OWA, UInt,0 )
DllCall( "SystemParametersInfo", UInt,0x30, UInt,0, UInt,&NWA, UInt,0 )
MsgBox, % NumGet(NWA,0) "`n" NumGet(NWA,4) "`n" NumGet(NWA,8) "`n" NumGet(NWA,12)
NumPut( NumGet(OWA,12)-GH, NWA,12 )                                      ; SPI_SETWORKAREA
MsgBox, % NumGet(NWA,0) "`n" NumGet(NWA,4) "`n" NumGet(NWA,8) "`n" NumGet(NWA,12)
DllCall( "SystemParametersInfo", UIint,0x2F, UInt,0, UInt,&NWA, UInt,0 )

Gui -Caption +ToolWindow +AlwaysOnTop +Border
GY := GY-GH
Gui, Show, x%GX% y%GY% w%GW% h%GH%
OnExit, QuitScript
Return

QuitScript:
 DllCall( "SystemParametersInfo", UIint,0x2F, UInt,0, UInt,&OWA, UInt,0 )
 OnExit
 ExitApp
Return
Back to top
View user's profile Send private message Send e-mail
Superfraggle



Joined: 02 Nov 2004
Posts: 1019
Location: London, UK

PostPosted: Tue Feb 03, 2009 9:45 pm    Post subject: Reply with quote

or
Code:
WinGetPos, TaskBar_X, TaskBar_Y, TaskBar_Width, TaskBar_Height, ahk_class Shell_TrayWnd
Gui_Y_2 := TaskBar_Y - 30
(...)
Gui, 2: -Caption +AlwaysOnTop +ToolWindow +LastFound
Gui_ID_2 := WinExist()
(...)
Gui, 2: Show, x0 y%Gui_Y_2% w%A_ScreenWidth% h30, Tip.It - Main
WinGetPos, GX,GY,GW,GH, ahk_id %Gui_ID_2%
(...)
ABM := DllCall( "RegisterWindowMessage", Str,"AppBarMsg" )
OnMessage( ABM, "ABM_Callback" )
VarSetCapacity( APPBARDATA , 36, 0 )
Off :=  NumPut(  36, APPBARDATA    )
Off :=  NumPut( hAB, Off+0 )
Off :=  NumPut( ABM, Off+0 )
Off :=  NumPut(   3, Off+0 )
Off :=  NumPut(  GX, Off+0 )
Off :=  NumPut(  GY, Off+0 )
Off :=  NumPut(  GW, Off+0 )
Off :=  NumPut(  GH, Off+0 )
Off :=  NumPut(   1, Off+0 )
GoSub, RegisterAppBar
(...)
Etc etc etc.

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
Frankie



Joined: 02 Nov 2008
Posts: 2850

PostPosted: Tue Feb 03, 2009 9:50 pm    Post subject: Reply with quote

Tested the first one. It works.
_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run
Back to top
View user's profile Send private message
Superfraggle



Joined: 02 Nov 2004
Posts: 1019
Location: London, UK

PostPosted: Tue Feb 03, 2009 9:56 pm    Post subject: Reply with quote

SKAN how come you didn't just modify your code??
it was setting ABE_TOP - Top edge.
this just needed changing to ABE_BOTTOM - Bottom edge.
_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Tue Feb 03, 2009 10:03 pm    Post subject: Reply with quote

Superfraggle wrote:
it was setting ABE_TOP - Top edge.


I did not notice it! You are eagle-eyed! Smile
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Wed Feb 04, 2009 12:53 am    Post subject: Reply with quote

Omg, TY to all of you! I learned quite a bit just browsing through it and seeing your methods. I got it to works and it is very much appreciated.

Curious though. SKAN, with your code in the thread that you pointed me to in your first post, THe windows automatically resized to make room for the new AppBar. Why will they not with the new code that you've posted?
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Wed Feb 04, 2009 7:24 am    Post subject: Reply with quote

Anonymous wrote:
Why will they not with the new code that you've posted?


It is a limitation of the method.. It just reserves workarea and only affects window maximization from the point when it is set. It is up to user to restore/maximize all windows after applying SPI_SETWORKAREA.
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Wed Feb 04, 2009 4:01 pm    Post subject: Reply with quote

Okay. I appreciate all the work you've done to help me out, SKAN. Not only in this thread but in my several others. You're a great help to this community.
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group