Every Windows system has a taskbar. The taskbar height can differ on each computer, even set to auto-hide...
I would like to use OpenWindow() with the height of the screen less the height of the taskbar, so that it is always visible and can be reached.
How can I get the current height setting?
Thanks.
How to: Get the current Windows taskbar height
How to: Get the current Windows taskbar height
- Windows 11 Home 64-bit
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: How to: Get the current Windows taskbar height
The taskbar can also be in different positions, not necessarily on the bottom of the screen. The way to accomplish your goal is to use SystemParametersInfo_() with #SPI_GETWORKAREA. This will give you the position and size of the desktop excluding the taskbar and you can create your window according to the returned rectangle.
BERESHEIT
Re: How to: Get the current Windows taskbar height
Many thanks Netmaestro. I could find it further on the forum by searching for SystemParametersInfo_.
The solution:
Have a good day.
The solution:
Code: Select all
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @DesktopRect.RECT, 0)
DesktopX = DesktopRect\left
DesktopY = DesktopRect\top
DesktopWidth = DesktopRect\right - DesktopRect\left
DesktopHeight = DesktopRect\bottom - DesktopRect\top
Debug "OpenWindow("+Str(DesktopX)+", "+Str(DesktopY)+", "+Str(DesktopWidth)+", "+Str(DesktopHeight)+")"
- Windows 11 Home 64-bit
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: How to: Get the current Windows taskbar height
Almost. You have to take into account that a PB window opened to supplied width and height will have a client area with those dimensions. You'll have to subtract the caption and borders to get what you're looking for:
Code: Select all
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @DesktopRect.RECT, 0)
DesktopX = DesktopRect\left
DesktopY = DesktopRect\top
DesktopWidth = DesktopRect\right - DesktopRect\left
DesktopHeight = DesktopRect\bottom - DesktopRect\top
DesktopWidth-GetSystemMetrics_(#SM_CXFIXEDFRAME)*2
DesktopHeight-(GetSystemMetrics_(#SM_CYCAPTION)+GetSystemMetrics_(#SM_CYFIXEDFRAME)*2)
OpenWindow(0,DesktopX,DesktopY,DesktopWidth,DesktopHeight,"",#PB_Window_SystemMenu)
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
BERESHEIT
Re: How to: Get the current Windows taskbar height
Indeed, this is more accurate.
I appreciate your help very much.
Richard
I appreciate your help very much.
Richard
- Windows 11 Home 64-bit
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: How to: Get the current Windows taskbar height
Thanks NETMAESTRO
I use your tips immediately, for my new application
I use your tips immediately, for my new application


Not a destination
Re: How to: Get the current Windows taskbar height
Everyone is advised to take cover, KCC is working on a new application! Lock up your dll's, hide those tips and tricks, and for God's sake don't let him near the drinks cabinet!Kwaï chang caïne wrote:Thanks NETMAESTRO
I use your tips immediately, for my new application

(Sorry KCC, I couldn't resist!)
I may look like a mule, but I'm not a complete ass.
Re: How to: Get the current Windows taskbar height
Haha, there we have the good old Kwaï chang caïne
I'm glad the code will be of use in your new application !
Hopely you will share it with us when finished

I'm glad the code will be of use in your new application !

Hopely you will share it with us when finished

- Windows 11 Home 64-bit
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: How to: Get the current Windows taskbar height
Oooohh, my master give to me the great honor to insult meMy MASTER wrote:Everyone is advised to take cover, KCC is working on a new application! Lock up your dll's, hide those tips and tricks, and for God's sake don't let him near the drinks cabinet!

It's already a pleasure to read you

Even when you take your legs was shot, for go far of KCC

It's a too long time, that i have not "blablabla" with you

My dream....you and me alone in a farmhouse :roll:

Me i drunk you with all my question...you like my grandma.... always answer to me, and kind with your little KCC, and in the same time, you knit socks or scarf for KCC against the hard winter :roll:
I'm sure it's also your dream...i'm sure

@CHARVISTA
Yes ....it's for my tiny "FlowChart"

For be sure the windows is open a maximum
Thanks for your kind message


Not a destination