Jump to content
  • Advertisement
Sign in to follow this  
gretty

Obtain Task Bar Docking Setting: Always returns ABE_LEFT

This topic is 889 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to determine which side the Windows Taskbar (System Tray?) is docked to - so I can position my popup window above/below/left/right of the taskbar. I am using SHAppBarMessage(ABM_QUERYPOS, &barData) to obtain this information but it always returns ABE_LEFT for me when my taskbar is ABE_TOP.

 

What's going wrong? Maybe I cant use that function to determine it? Maybe my APPBARDATA params are wrong? Its difficult to check whether the function call is successful, see MSDN documentation for return value - not quite sure what the successful value should be.

HWND taskBar = FindWindow(_T("Shell_TrayWnd"), NULL); // taskBar is valid and not null

APPBARDATA barData{};
barData.cbSize = sizeof(APPBARDATA);
barData.hWnd = taskBar;
barData.uCallbackMessage = 0;
//barData.uEdge = ABE_RIGHT;
//barData.rc = RECT{0,0300,300};
barData.lParam = (LPARAM)FALSE;
UINT_PTR res = SHAppBarMessage(ABM_QUERYPOS, &barData);

// barData.uEdge always equals ABE_LEFT

// Unsure how to check res for error: see MSDN documentation - not very helpful
Edited by gretty

Share this post


Link to post
Share on other sites
Advertisement

Looks like I was using the wrong flag. The following works:

APPBARDATA barData {0};
barData.cbSize = sizeof(APPBARDATA);
UINT_PTR res = SHAppBarMessage(ABM_GETTASKBARPOS, &barData);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!