Results 1 to 5 of 5

Thread: Taskbar question.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Westminster, Md.
    Posts
    163
    I've looked through the boards and there are a number of postings about it but I'm not sure I understand.

    How does one find the height in Twips of the taskbar? I'd like my application form to fill the screen vertically but not horizontally.

    The answers I've seen before use the GetDesktop and GetRect APIs. But looking at it closely they both end up returning the size of the whole screen... that's not what I want..

    I just want the size of the taskbar, so that if it's on the bottom I can make my form Screen.height-Taskbar.height.

    Any ideas?
    Eiredrake

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    well if they gve you something like 1024 * 768 then you only need one number...is that what it outputs?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Westminster, Md.
    Posts
    163

    REturns

    They return a long which is the actual Height of the screen in pixels presumably... But when I converted it, it was 9000. The same thing that Screen.Height returned. So it's not what I want.

    If the whole screen is 9000 twips... then I just need to get the taskbar's height. The usable screen would presumably be Screen.Height-Taskbar.height. Only problem is either way I try to get the height it's returning the same value. 9000.


    Eiredrake

  4. #4
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    just use the SHAppBarMessage API

    Code:
    Option Explicit
    
    Private Const ABM_GETTASKBARPOS = &H5
    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 Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long
    
    Private Function GetTaskBarHeight() As Single
    Dim uData As APPBARDATA
    
    Call SHAppBarMessage(ABM_GETTASKBARPOS, uData)
    
    GetTaskBarHeight = ScaleY(uData.rc.Bottom - uData.rc.Top, vbPixels, vbTwips)
    
    End Function
    because of the scaleY function this only works inside a form, if you want it inside a module you'll have to change that line to Form1.ScaleY(... or something.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Westminster, Md.
    Posts
    163

    !!

    Thanks Muchly!


    Eiredrake

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