How to switch the Autohide Taskbar?

I am writing a screen saver, and would like to detect an autohide taskbar to turn it off (to non-autohide). I found the function SHAppBarMessage with ABM_AUTOHIDEBAR, which takes a APPBARDATRA structure. I try to call it, but I do not get anything back. (return either null or zero). What should I put in the hwnd of the APPBARDATA structure to pass to the function (or do I have to initialize it, if yes with what?)
When I use ABM_GETSTATE, I guess I need the hwnd of the task bar, how else can I get the handle of the taskbar?
hshliangAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hshliangAuthor Commented:
Edited text of question.
0
mjswartCommented:
Here's a part answer for finding the handle of the taskbar:
HWND hwnd = ::FindWindow("Shell_TrayWnd", NULL);

Shell_TrayWnd is the class name of the bar.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hshliangAuthor Commented:
Thank you, I got a window handle, but when I try to turn off the autohide by SHAppBarMessage(ABM_SETAUTODIEBAR, pabd) with param of pabd's hWnd = the handle and lParam = FALSE, I was not able to change the task bar to non autohide, what's the problem?
I check it before and after the ABM_SETAUTOHDIEBAR call by ABM_GETSTATE, it return '3' before or after.
0
mjswartCommented:
I've tried this out and for your purposes (screensaver) it should do what you want:

      HWND hwnd = ::FindWindow("Shell_TrayWnd", NULL);
      WINDOWPLACEMENT wp;
      ::GetWindowPlacement(hwnd, &wp);
      wp.showCmd = SW_HIDE;
      ::SetWindowPlacement(hwnd, &wp);
      Sleep(10000); // Do what you want to do
      wp.showCmd = SW_RESTORE;
      ::SetWindowPlacement(hwnd, &wp);

This way the tray bar is hid, plus you're not messing with the user's preferences.

Good luck
0
hshliangAuthor Commented:
dear mjswart,
Thank you for you suggestion. I am so stuck with the SHAppBarMessage, I was trying all the commands without any effect. Is SHAppBarMessage not able to change the TaskBar?
I use your suggestion of ShowWindow, it serve the prupose, viz, make the taskbar invisible. I got what I want although I still do not know why taskbar is not changed by SHAppBarMessage.
thank you any way, you got the credits!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.