LB Booster
Programming >> Liberty BASIC language >> Taskbar position and size?
http://lbb.conforums.com/index.cgi?board=lblang&action=display&num=1438779315

Taskbar position and size?
Post by Monkfish on Aug 5th, 2015, 12:55pm

My forms display in various sizes. Some are small, some short but wider than the screen, some thin but longer than the screen, some are twice the size of the screen. I have worked out how to display them correctly with scrollbars etc, but accounting for the taskbar is a real pain.

Is there an easy way to find out the size and position of the taskbar? Or just the size would help as few people have the taskbar anywhere other than the bottom.

I don't really want to work with maximised windows if I can help it.

Thank you smiley
Re: Taskbar position and size?
Post by Monkfish on Aug 5th, 2015, 2:26pm

I found some code by Stefan Pendl. Just the job smiley

http://libertybasic.conforums.com/index.cgi?board=novice&action=display&num=1269956995

Re: Taskbar position and size?
Post by Richard Russell on Aug 5th, 2015, 4:36pm

on Aug 5th, 2015, 2:26pm, Monkfish wrote:
I found some code by Stefan Pendl. Just the job smiley

http://libertybasic.conforums.com/index.cgi?board=novice&action=display&num=1269956995

I am pleased that you have found a solution, but if I click on that link I simply receive a message that I have been banned from the forum. cry

Richard.
Re: Taskbar position and size?
Post by RobM on Aug 5th, 2015, 6:05pm

The code Stephan posted uses SystemParametersInfoA to find the usable area of the desktop.

Quote:
Below find an example of detecting the size of the area not occupied by any task or side bars.



Code:
    nomainwin

' get the size of the desktop area
' not occupied by the task bar
' or any application side bar
    struct RECT, _
        left   as long, _
        top    as long, _
        right  as long, _
        bottom as long

    uiAction = _SPI_GETWORKAREA

    calldll #user32, "SystemParametersInfoA", _
        uiAction as ulong, _
        uiParam  as ulong, _
        RECT     as struct, _
        fWinIni  as ulong, _
        result   as long

' get the coordinates of the rectangle
    PosLeft   = RECT.left.struct
    PosTop    = RECT.top.struct
    PosRight  = RECT.right.struct
    PosBottom = RECT.bottom.struct

' calculate the maximum window size
    MaxWindowWidth = PosRight - PosLeft
    MaxWindowHeight = PosBottom - PosTop

' set the window size
    WindowWidth = MaxWindowWidth
    WindowHeight = MaxWindowHeight

' set the window position
    UpperLeftX = PosLeft + 1
    UpperLeftY = PosTop + 1

' display the window
    open "Full Screen Window with Task Bar showing" for window as #m
    #m "trapclose [quit]"
    wait

[quit]
    close #m
    end
 

Re: Taskbar position and size?
Post by Richard Russell on Aug 5th, 2015, 8:38pm

on Aug 5th, 2015, 6:05pm, RobM wrote:
The code Stephan posted uses SystemParametersInfoA to find the usable area of the desktop.

Excellent. Using _SPI_GETWORKAREA is what I would have suggested too.

Richard.