Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Hide taskbar and change DPI settings??

Hide taskbar and change DPI settings??

Scheduled Pinned Locked Moved C#
questioncsharp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    r9
    wrote on last edited by
    #1

    Is it possible from C# to hide the windows taskbar? And how do I change the DPI settings? (I want to force 96 DPI, Small Fonts). Thanks Regards Thomas

    D 1 Reply Last reply
    0
    • R r9

      Is it possible from C# to hide the windows taskbar? And how do I change the DPI settings? (I want to force 96 DPI, Small Fonts). Thanks Regards Thomas

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      No, you can't hide the task bar. Start/Run "gpedit.msc" to open up the policy editor, then select User Configuration/Administrative Templates to see everything you can do to the Desktop/Start Menu/Task Bar/System/... The settings for the video card shouldn't be messed with by your application. Changing these will affect all the users of a machine, not just one. You would have to change these settings in the Registry first, then retart the machine for them to take effect. See HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current for the settings. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      H 1 Reply Last reply
      0
      • D Dave Kreskowiak

        No, you can't hide the task bar. Start/Run "gpedit.msc" to open up the policy editor, then select User Configuration/Administrative Templates to see everything you can do to the Desktop/Start Menu/Task Bar/System/... The settings for the video card shouldn't be messed with by your application. Changing these will affect all the users of a machine, not just one. You would have to change these settings in the Registry first, then retart the machine for them to take effect. See HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current for the settings. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        Actually, you can using by P/Invoking the SHAppBarMessage function and sending ABM_SETSTATE. You can turn on it's auto-hide feature, which Internet Explorer does when you switch to full-screen mode (which I love for certain purposes). I agree about the DPI, though. Changing the resolution (when necessary, like for a full-screen game or kiosk) is one thing, but the DPI is another.

        Microsoft MVP, Visual C# My Articles

        R 1 Reply Last reply
        0
        • H Heath Stewart

          Actually, you can using by P/Invoking the SHAppBarMessage function and sending ABM_SETSTATE. You can turn on it's auto-hide feature, which Internet Explorer does when you switch to full-screen mode (which I love for certain purposes). I agree about the DPI, though. Changing the resolution (when necessary, like for a full-screen game or kiosk) is one thing, but the DPI is another.

          Microsoft MVP, Visual C# My Articles

          R Offline
          R Offline
          r9
          wrote on last edited by
          #4

          Heath Stewart: I am new to windows programming. Can you show me how to use the SHAppBarMessage function via P/Invoke? Regards Thomas

          H 1 Reply Last reply
          0
          • R r9

            Heath Stewart: I am new to windows programming. Can you show me how to use the SHAppBarMessage function via P/Invoke? Regards Thomas

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            You should first read about P/Invoke. See Consuming Unmanaged DLL Functions[^] in the .NET Framework SDK. Just jumping into something without understanding is never a good idea. You can P/Invoke the SHAppBarMessage like so:

            [DllImport("shell32.dll")]
            [return: MarshalAs(UnmanagedType.SysUInt)]
            private static extern IntPtrSHAppBarMessage(
            [MarshalAs(UnmanagedType.U4)] int dwMessage,
            APPBARDATA data);
             
            [StructLayout(LayoutKind.Sequential)]
            public struct APPBARDATA
            {
            [MarshalAs(UnmanagedType.U4)] public int size;
            public IntPtr handle;
            [MarshalAs(UnmanagedType.SysUInt)] public IntPtr callbackMessage;
            [MarshalAs(UnmanagedType.SysUInt)] public IntPtr edge;
            public RECT rc;
            public IntPtr lParam;
            }
             
            [StructLayout(LayoutKind.Sequential)]
            public struct RECT
            {
            public int left;
            public int top;
            public int right;
            public int bottom;
            }

            In order to pass the right messages, read about the SHAppBarMessage[^] API. There is also an example on CodeProject you can take a look at. Read C# does Shell, Part 3[^]. To get the HWND for the task bar, you'll need to also P/Invoke FindWindow and search for the window class "Shell_TrayWnd". That'll give you the IntPtr to assign to the APPBARDATA.handle field. You can find more P/Invoke signatures for common Windows APIs at http://pinvoke.net[^].

            Microsoft MVP, Visual C# My Articles

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups