Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would I find the height of the task bar?

In my windows application, I am trying to find the height of the task bar. While I can hard program this into my program, I would like to find it programmatically to support past, present (win7) and future windows versions.

So, how would I do this?

like image 530
Alexander Rafferty Avatar asked Dec 08 '22 01:12

Alexander Rafferty


2 Answers

You get it from GetMonitorInfo(), MONITORINFOEX.rcWork member.

Get the HMONITOR that you need to call this function from, say, MonitorFromRect(), passing your window rectangle. Or MonitorFromPoint() or EnumDisplayMonitors(), depends where you want to display your window. (0,0) is always the upper left corner of the primary monitor.

like image 119
Hans Passant Avatar answered Dec 09 '22 14:12

Hans Passant


Ask Windows about it using the ABM_GETTASKBAR message and specifying the hwnd for the taskbar.

like image 33
Franci Penov Avatar answered Dec 09 '22 13:12

Franci Penov