Thread: How do I show the taskbar without activating it?

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    1

    How do I show the taskbar without activating it?

    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

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    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);
      }
     }
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. not show my program on taskbar
    By ReXXuSS in forum C Programming
    Replies: 12
    Last Post: 08-19-2006, 03:27 AM
  2. Getting all window handles on taskbar
    By Yuri in forum Windows Programming
    Replies: 1
    Last Post: 06-17-2006, 04:31 PM
  3. Replies: 0
    Last Post: 11-08-2005, 02:28 AM
  4. how to show the % sign and remove decimals?
    By seal in forum C Programming
    Replies: 5
    Last Post: 08-31-2005, 05:29 PM
  5. Problem with an icon in the TaskBar status area
    By dit6a9 in forum Windows Programming
    Replies: 2
    Last Post: 08-16-2004, 10:33 PM