Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 530687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:13:23+00:00 2026-05-13T09:13:23+00:00

I need to know whether the Windows taskbar is hidden or not. I believe

  • 0

I need to know whether the Windows taskbar is hidden or not. I believe there is no .NET method to do this, and also I have come across a lot of “how to hide and show the taskbar” samples, but I haven’t seen anything based on what I am looking for. I am not familiar with the Windows API, so I find it hard to understand traditional Windows code. Can someone please direct me to an article or type code telling whether the current state of the taskbar is hidden or not? I am coding in C#.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:13:23+00:00Added an answer on May 13, 2026 at 9:13 am

    winSharp93 presents a helper class (“Find out Size (and position) of the taskbar“) that seems to work. It uses Win32’s SHAppBarMessage function.

    Here’s the code (with minor additions) from his blog:

    using System;
    using System.Drawing;
    using System.Runtime.InteropServices;
    
    namespace TaskbarTest
    {
        public enum TaskbarPosition
        {
            Unknown = -1,
            Left,
            Top,
            Right,
            Bottom,
        }
    
        public sealed class Taskbar
        {
            private const string ClassName = "Shell_TrayWnd";
    
            public Rectangle Bounds {
                get;
                private set;
            }
            public TaskbarPosition Position {
                get;
                private set;
            }
            public Point Location {
                get {
                    return this.Bounds.Location;
                }
            }
            public Size Size {
                get {
                    return this.Bounds.Size;
                }
            }
            //Always returns false under Windows 7
            public bool AlwaysOnTop {
                get;
                private set;
            }
            public bool AutoHide {
                get;
                private set;
            }
    
            public Taskbar() {
                IntPtr taskbarHandle = User32.FindWindow(Taskbar.ClassName, null);
    
                APPBARDATA data = new APPBARDATA();
                data.cbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA));
                data.hWnd = taskbarHandle;
                IntPtr result = Shell32.SHAppBarMessage(ABM.GetTaskbarPos, ref data);
                if (result == IntPtr.Zero)
                    throw new InvalidOperationException();
    
                this.Position = (TaskbarPosition)data.uEdge;
                this.Bounds = Rectangle.FromLTRB(data.rc.left, data.rc.top, data.rc.right, data.rc.bottom);
    
                data.cbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA));
                result = Shell32.SHAppBarMessage(ABM.GetState, ref data);
                int state = result.ToInt32();
                this.AlwaysOnTop = (state & ABS.AlwaysOnTop) == ABS.AlwaysOnTop;
                this.AutoHide = (state & ABS.Autohide) == ABS.Autohide;
            }
        }
    
        public enum ABM : uint
        {
            New = 0x00000000,
            Remove = 0x00000001,
            QueryPos = 0x00000002,
            SetPos = 0x00000003,
            GetState = 0x00000004,
            GetTaskbarPos = 0x00000005,
            Activate = 0x00000006,
            GetAutoHideBar = 0x00000007,
            SetAutoHideBar = 0x00000008,
            WindowPosChanged = 0x00000009,
            SetState = 0x0000000A,
        }
    
        public enum ABE : uint
        {
            Left = 0,
            Top = 1,
            Right = 2,
            Bottom = 3
        }
    
        public static class ABS
        {
            public const int Autohide = 0x0000001;
            public const int AlwaysOnTop = 0x0000002;
        }
    
        public static class Shell32
        {
            [DllImport("shell32.dll", SetLastError = true)]
            public static extern IntPtr SHAppBarMessage(ABM dwMessage, [In] ref APPBARDATA pData);
        }
    
        public static class User32
        {
            [DllImport("user32.dll", SetLastError = true)]
            public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
        }
    
        [StructLayout(LayoutKind.Sequential)]
        public struct APPBARDATA
        {
            public uint cbSize;
            public IntPtr hWnd;
            public uint uCallbackMessage;
            public ABE uEdge;
            public RECT rc;
            public int lParam;
        }
    
        [StructLayout(LayoutKind.Sequential)]
        public struct RECT
        {
            public int left;
            public int top;
            public int right;
            public int bottom;
        }
    }
    

    The author claims it works on his Windows 7 machine and it appears to work on my XP Pro machine.

    Here’s how you might use it:

        Taskbar tb = new Taskbar();
        Console.WriteLine("w:{0}, h:{1} - hide:{2}", tb.Size.Width, tb.Size.Height, tb.AutoHide);
    

    Where: tb.Size.Width and tb.Size.Height returns the width and height of the Taskbar, and tb.AutoHide returns true if the Taskbar is hidden and false if it is not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 292k
  • Answers 292k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Is Silverlight a valid alternative for all web/thick client development?… May 13, 2026 at 6:16 pm
  • Editorial Team
    Editorial Team added an answer Mappings are compiled on application startup, and once that's happened… May 13, 2026 at 6:16 pm
  • Editorial Team
    Editorial Team added an answer Contrary to what Mitch has stated, you don't need a… May 13, 2026 at 6:16 pm

Related Questions

I have a windows mobile app (mymobiler) that i am trying to install and
I asked a similar question yesterday, but recognize that i need to rephase it
This may not be considered to be directly programming related but I am at
I need to know whether Microsoft Word, Excel, Outlook, Project, etc are installed in
I've written a simple calendar control to allow for selecting single days, weeks, months

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.