Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect height and orientation of taskbar in Windows with autohide enabed?

I am using Qt, what I want to do is to display custom popup over the icon in system tray in Windows. I can obtain icon coordinates by using geometry() and taskbar height by finding difference between screenGeometry() and availableGeometry(). So the popup can be alligned correctly and does not overlap taskbar for different taskbar orientations (e.g. when taskbar is on the left side or on the top of the screen).

The problem starts when autohide of taskbar is turned on, then apparently availableGeometry returns the same value as screenGeometry, and I cannot find the taskbar height anymore. This results in the popup overlapping with taskbar, or even displayed at the wrong location.

My question is: how can I detect correctly orientation and size of taskbar in Windows, when the autohide is enabled? Should I use some winapi function, or can I do it purely in Qt (preferable) ?

like image 543
tomak Avatar asked Oct 23 '22 03:10

tomak


1 Answers

1) Autohide state you check using this: http://msdn.microsoft.com/en-us/library/bb787947(v=vs.85).aspx 2) And find width/height/orientation using this: http://msdn.microsoft.com/en-us/library/bb787953(v=vs.85).aspx

Hope this helps. Yes, this is WinAPI functions, so you should use this code in "#ifdef Q_OS_WINDOWS" only - if want to compile on Linux too.

like image 167
Raxillan Avatar answered Oct 27 '22 10:10

Raxillan