Share your advanced PureBasic knowledge/code with the community.
ebs
Enthusiast
Posts: 561 Joined: Fri Apr 25, 2003 11:08 pm
Post
by ebs » Mon May 24, 2004 6:54 pm
Code updated for 5.20+
Code: Select all
#ABS_BOTH = #ABS_ALWAYSONTOP | #ABS_AUTOHIDE
TBMsg.s
Procedure.l Taskbar()
Bardata.APPBARDATA
ProcedureReturn SHAppBarMessage_(#ABM_GETSTATE, Bardata)
EndProcedure
Select Taskbar()
Case #ABS_ALWAYSONTOP
TBMsg = "Always On Top"
Case #ABS_AUTOHIDE
TBMsg = "Auto-Hide"
Case #ABS_BOTH
TBMsg = "Always On Top and Auto-Hide"
Default
TBMsg = "NOT Always On Top or Auto-Hide"
EndSelect
MessageRequester("Taskbar Status", TBMsg)
fsw
Addict
Posts: 1603 Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest
Post
by fsw » Mon May 24, 2004 10:18 pm
Here is my old code that gives you even more information:
viewtopic.php?t=3609&highlight=appbar
You can also find it in the Andre's codearchive as:
Windows_System\Taskbar\AppBar-StatusInfo.pb
BTW: If you look at my code you will see that it's pretty old, even before the APPBARDATA structure made it into PB.
Maybe all OLD templates in the codearchive should be updated to the newest PB version.
Any takers... 8O
fsw
Addict
Posts: 1603 Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest
Post
by fsw » Mon May 24, 2004 11:21 pm
OK, I volunteered for my old code...
Code: Select all
; English forum:
; Author: Franco (aka FSW)
; Date: May 2004
; (c) 2004 Franco's template - absolutely freeware
; What is the status of the Windows-AppBar?
#ABS_ALWAYSONTOP_AND_AUTOHIDE = #ABS_ALWAYSONTOP | #ABS_AUTOHIDE
Info.APPBARDATA
; Is AutoHide of AppBar active ?
AppBarHide=SHAppBarMessage_(#ABM_GETSTATE, Info)
If AppBarHide = #NULL : AppBarHide$ = "no, and not always on top." : EndIf
If AppBarHide = #ABS_ALWAYSONTOP : AppBarHide$ = "no, and always on top." : EndIf
If AppBarHide = #ABS_AUTOHIDE : AppBarHide$ = "yes, but not always on top." : EndIf
If AppBarHide = #ABS_ALWAYSONTOP_AND_AUTOHIDE : AppBarHide$ = "yes, and always on top." : EndIf
; Position of the Windows-AppBar
SHAppBarMessage_(#ABM_GETTASKBARPOS,Info)
If Info\uEdge = #ABE_LEFT : Position$ = "left" : EndIf
If Info\uEdge = #ABE_TOP : Position$ = "top" : EndIf
If Info\uEdge = #ABE_RIGHT : Position$ = "right" : EndIf
If Info\uEdge = #ABE_BOTTOM : Position$ = "bottom" : EndIf
; Visible Height and Width of the Windows-AppBar
; Real AppBar is always 2 pixel outside the Desktop
; Only Micro$oft know's why! (maybe because of the border...)
; Value of Height and Width: pixel
LeftX$ = Str(Info\rc\left)
LeftY$ = Str(Info\rc\top)
RightX$ = Str(Info\rc\right)
RightY$ = Str(Info\rc\bottom)
; Now it's time to view the information
Text$ = "AutoHide of AppBar active: " + AppBarHide$
Text$ = Text$ + Chr(13) + "Position of AppBar: " + Position$ + Chr(13)
Text$ = Text$ + Chr(13) + "Remember:"
Text$ = Text$ + Chr(13) + "AppBar is always 2 pixel outside the Desktop!"
Text$ = Text$ + Chr(13) + "Only Micro$oft know's why!" + Chr(13)
RealHeight$ = Str(Info\rc\bottom - Info\rc\top)
Text$ = Text$ + Chr(13 )+ "Real Height of AppBar: " + RealHeight$
RealWidth$ = Str(Info\rc\right - Info\rc\left)
Text$ = Text$ + Chr(13) + "Real Width of AppBar: " + RealWidth$ + Chr(13)
Text$ = Text$ + Chr(13) + "Real left X position of AppBar: " + LeftX$
Text$ = Text$ + Chr(13) + "Real left Y position of AppBar: " + LeftY$
Text$ = Text$ + Chr(13) + "Real right X position of AppBar: " + RightX$
Text$ = Text$ + Chr(13) + "Real right Y position of AppBar: " + RightY$ + Chr(13)
If Info\uEdge = 0 Or Info\uEdge = #ABE_RIGHT : VisibleHeight$ = Str(Info\rc\bottom - Info\rc\top-4) : Else : VisibleHeight$ = Str(Info\rc\bottom - Info\rc\top-2) : EndIf
Text$=Text$+Chr(13)+"Visible Height of AppBar: "+VisibleHeight$
If Info\uEdge = #ABE_LEFT Or Info\uEdge = #ABE_BOTTOM : VisibleWidth$ = Str(Info\rc\right-Info\rc\left-4) : Else : VisibleWidth$=Str(Info\rc\right - Info\rc\left-2) : EndIf
Text$ = Text$ + Chr(13) + "Visible Width of AppBar: " + VisibleWidth$ + Chr(13)
If Info\uEdge = #ABE_LEFT : RightX$ = Str(Info\rc\right) : Else : RightX$ = Str(Info\rc\right -2) : EndIf
If Info\uEdge = #ABE_TOP : RightY$ = Str(Info\rc\bottom) : Else : RightY$ = Str(Info\rc\bottom - 2) : EndIf
If Info\uEdge = #ABE_RIGHT : LeftX$ = Str(Info\rc\left) : Else : LeftX$ = Str(Info\rc\left + 2) : EndIf
If Info\uEdge = #ABE_BOTTOM : LeftY$ = Str(Info\rc\top) : Else : LeftY$ = Str(Info\rc\top + 2) : EndIf
Text$ = Text$ + Chr(13) + "Visible left X position of AppBar: " + LeftX$
Text$ = Text$ + Chr(13) + "Visible left Y position of AppBar: " + LeftY$
Text$ = Text$ + Chr(13) + "Visible right X position of AppBar: " + RightX$
Text$ = Text$ + Chr(13) + "Visible right Y position of AppBar: " + RightY$
MessageRequester("(c) Franco's AppBarInfo", Text$)
End
Seldon
Enthusiast
Posts: 405 Joined: Fri Aug 22, 2003 7:12 am
Location: Italia
Post
by Seldon » Tue Jun 01, 2004 6:58 am
Thanks for sharing this nice trick. I'd like to know, is it possible to change the property HIDE/SHOW by a program ? Thanks in advance.