Author |
Topic: Taskbar position and size? (Read 846 times) |
|
Monkfish
Full Member
member is offline
Gender:
Posts: 104
|
|
Taskbar position and size?
« Thread started 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
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: Taskbar position and size?
« Reply #2 on: Aug 5th, 2015, 4:36pm » |
|
on Aug 5th, 2015, 2:26pm, Monkfish wrote: 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.
Richard.
|
|
Logged
|
|
|
|
RobM
Junior Member
member is offline
Posts: 91
|
|
Re: Taskbar position and size?
« Reply #3 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
|
« Last Edit: Aug 5th, 2015, 6:07pm by RobM » |
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: Taskbar position and size?
« Reply #4 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.
|
|
Logged
|
|
|
|
|