 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guestisism Guest
|
Posted: Tue Feb 03, 2009 5:44 pm Post subject: Unoccupiable space? |
|
|
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
|
Posted: Tue Feb 03, 2009 6:41 pm Post subject: |
|
|
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 |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
|
| Back to top |
|
 |
Guestisism Guest
|
Posted: Tue Feb 03, 2009 8:16 pm Post subject: |
|
|
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
|
Posted: Tue Feb 03, 2009 8:39 pm Post subject: |
|
|
| 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 |
|
 |
Guest
|
Posted: Tue Feb 03, 2009 8:59 pm Post subject: |
|
|
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
|
Posted: Tue Feb 03, 2009 9:12 pm Post subject: |
|
|
| 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
|
Posted: Tue Feb 03, 2009 9:42 pm Post subject: |
|
|
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 |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 1019 Location: London, UK
|
Posted: Tue Feb 03, 2009 9:45 pm Post subject: |
|
|
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 |
|
 |
Frankie
Joined: 02 Nov 2008 Posts: 2850
|
Posted: Tue Feb 03, 2009 9:50 pm Post subject: |
|
|
Tested the first one. It works. _________________ aboutscript ⍟ apps ⍟ scripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 1019 Location: London, UK
|
Posted: Tue Feb 03, 2009 9:56 pm Post subject: |
|
|
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 |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Tue Feb 03, 2009 10:03 pm Post subject: |
|
|
| Superfraggle wrote: | | it was setting ABE_TOP - Top edge. |
I did not notice it! You are eagle-eyed!  |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Feb 04, 2009 12:53 am Post subject: |
|
|
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
|
Posted: Wed Feb 04, 2009 7:24 am Post subject: |
|
|
| 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 |
|
 |
Guest
|
Posted: Wed Feb 04, 2009 4:01 pm Post subject: |
|
|
| 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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|