I want make the taskbar visible from my program. I don't want to make the taskbar active, only visible so I can see the system tray when I have the auto-hide taskbar option enabled in Windows. Is there any way to do this?
/Anders
This is a discussion on How do I show the taskbar without activating it? within the Windows Programming forums, part of the Platform Specific Boards category; I want make the taskbar visible from my program. I don't want to make the taskbar active, only visible so ...
I want make the taskbar visible from my program. I don't want to make the taskbar active, only visible so I can see the system tray when I have the auto-hide taskbar option enabled in Windows. Is there any way to do this?
/Anders
This function should do it:
Code:void SetTaskbarScreenArea(BOOL bFull){ RECT rcScreen; GetWindowRect(GetDesktopWindow(),&rcScreen); if(bFull){ SystemParametersInfo(SPI_SETWORKAREA,0,&rcScreen,SPIF_SENDCHANGE); } else { RECT rcVis,rcScreen,rcTask; HWND taskbar=FindWindow("Shell_TrayWnd",0); // get taskbar window BOOL istaskbar=taskbar&&IsWindow(taskbar)&&IsWindowVisible(taskbar); if(istaskbar) GetWindowRect(taskbar,&rcTask); else SetRectEmpty(&rcTask); SubtractRect(&rcVis,&rcScreen,&rcTask); SystemParametersInfo(SPI_SETWORKAREA,0,&rcVis,SPIF_SENDCHANGE); } } void ShowTaskbar(BOOL bShow){ HWND taskbar=FindWindow("Shell_TrayWnd",0); // get taskbar window BOOL istaskbar=taskbar&&IsWindow(taskbar); if(istaskbar){ if(bShow){ ShowWindow(taskbar,SW_RESTORE); SetTaskbarScreenArea(FALSE); } else { ShowWindow(taskbar,SW_HIDE); SetTaskbarScreenArea(TRUE); } } }
Peter O. Programming tips