AutoHotkey Community

It is currently May 26th, 2012, 3:03 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Unoccupiable space?
PostPosted: February 3rd, 2009, 6:44 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 7:41 pm 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 8:46 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
AppBar: http://www.autohotkey.com/forum/viewtop ... 640#143640

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 9:16 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 9:39 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 9:59 pm 
Image

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. ^^.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 10:12 pm 
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).


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 10:42 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 10:45 pm 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 10:50 pm 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
Tested the first one. It works.

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 10:56 pm 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 11:03 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Superfraggle wrote:
it was setting ABE_TOP - Top edge.


I did not notice it! You are eagle-eyed! :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2009, 1:53 am 
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?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2009, 8:24 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2009, 5:01 pm 
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.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: G. Sperotto, patgenn123, Tilter_of_Windmills and 23 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