Results 1 to 8 of 8

Thread: [RESOLVED] Getting Taskbar Properties

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2007
    Posts
    55

    Resolved [RESOLVED] Getting Taskbar Properties

    Is there anyway to get the taskbar properties, such as height or autohide properties?

    I need to have a particular window flush against the taskbar if it's multiple rows tall or all the way to the bottom of the screen if its set to autohide.

    Thanks.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Getting Taskbar Properties

    Does this help?
    Code:
    Private Declare Function AppBarMessage Lib "shell32.dll" Alias "SHAppBarMessage" _
    (ByVal dwMessage As Long, pData As APPBARDATA) As Long 
    
    Private Type RECT 
    Left As Long 
    Top As Long 
    Right As Long 
    Bottom As Long 
    End Type 
    
    Private Type APPBARDATA 
    cbSize As Long 
    hwnd As Long 
    uCallbackMessage As Long 
    uEdge As Long 
    rc As RECT 
    lParam As Long ' message specific 
    End Type 
    
    Private BarData As APPBARDATA 
    Private MyPos As String 
    
    Private Const ABM_GETTASKBARPOS As Long = &H5& 
    
    Private Sub GetTaskBarPos() 
    
    Dim WhereAmI As Long 
    BarData.cbSize = Len(BarData) 
    WhereAmI = AppBarMessage(ABM_GETTASKBARPOS, BarData) 
    
    MyPos = "Top = " & BarData.rc.Top & vbCrLf 'contains top most position 
    MyPos = MyPos & "Bottom = " & BarData.rc.Bottom & vbCrLf 'contains bottom most position 
    MyPos = MyPos & "Left = " & BarData.rc.Left & vbCrLf 'contains far left position 
    MyPos = MyPos & "Right = " & BarData.rc.Right & vbCrLf 'contains far right position 
    MsgBox MyPos
    End Sug

  3. #3
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Getting Taskbar Properties

    SPI_GETWORKAREA may work too.
    http://www.vb-helper.com/howto_center_form.html
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  4. #4

    Thread Starter
    Member
    Join Date
    Apr 2007
    Posts
    55

    Re: Getting Taskbar Properties

    Almost. If the bar's not on autohide I can size the window accordingly, positioning it with the a difference of the taskbar's height. But if the taskbar is on autohide, I am still getting it's height and this there's always a space between the bottom of the screen and my window.

    Do you know anyway I can get the autohide boolean property?

  5. #5
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Getting Taskbar Properties

    Add this into Hack's code after WhereAmI = AppBarMessage(ABM_GETTASKBARPOS, BarData) line.
    Code:
    Dim IsTaskbarAutoHideOn As Boolean
    IsTaskbarAutoHideOn = AppBarMessage(ABM_GETSTATE, BarData) And ABS_AUTOHIDE
    Declarations:
    Code:
    Private Const ABM_GETSTATE As Long = &H4
    Private Const ABS_AUTOHIDE As Long = &H1
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  6. #6

    Thread Starter
    Member
    Join Date
    Apr 2007
    Posts
    55

    Re: Getting Taskbar Properties

    Thanks! Everything works flawlessly now. Thanks to everyone for your input and help.

    Cheers.

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Getting Taskbar Properties

    Quote Originally Posted by iPrank
    Add this into Hack's code after WhereAmI = AppBarMessage(ABM_GETTASKBARPOS, BarData) line.
    Code:
    Dim IsTaskbarAutoHideOn As Boolean
    IsTaskbarAutoHideOn = AppBarMessage(ABM_GETSTATE, BarData) And ABS_AUTOHIDE
    Declarations:
    Code:
    Private Const ABM_GETSTATE As Long = &H4
    Private Const ABS_AUTOHIDE As Long = &H1
    Nice one iPrank!

  8. #8
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: [RESOLVED] Getting Taskbar Properties

    LOL ! Two times, last rep points I needed for another jewel, came from you.
    Thanks.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width