Click here to Skip to main content
15,867,771 members
Articles / Desktop Programming / Windows Forms

A Simplified Solution for Hiding the Taskbar and Start Orb in Vista and Windows 7

Rate me:
Please Sign up or sign in to vote.
4.50/5 (8 votes)
21 Jul 2010CPOL2 min read 50.3K   1.1K   12   11
This article describes a simple solution for hiding the Taskbar and the Start Orb that works on both Vista and Windows 7.

Introduction

The article Hiding the Taskbar and Start menu (Start Orb) in Windows Vista describes a method for hiding the Vista Start Globe. Unfortunately, it's pretty complex. I found an alternate solution for hiding the Start Globe on Vista and Windows 7 that I haven't found documented anywhere on the Internet. This article describes that simplified method.

Method

The general strategy is to use P/Invoke to call the Win32 functions FindWindowEx and ShowWindow. The trick is to declare the FindWindowEx function in a slightly non-standard way and then pass it a special undocumented argument. This will allow us to hide that pesky Vista Start Globe.

The first step is to declare FindWindowEx as follows. The important part of this declaration is in the third argument. Most P/Invoke declarations for this function use a string for this argument. We're going to us an IntPtr.

C#
[DllImport("user32.dll")]
private static extern IntPtr FindWindowEx(IntPtr parentHwnd, 
        IntPtr childAfterHwnd, IntPtr className, string windowText);

Once we've declared this function, we can access the window handle for the Start Orb by passing in the undocumented hexadecimal value 0xC017 and casting it to an IntPtr. The final argument will likely change for languages other than English, though there might be a nice international way to retrieve this string.

C#
IntPtr hwndOrb = FindWindowEx(IntPtr.Zero, IntPtr.Zero, (IntPtr)0xC017, null);

After we've got our window handle, we can hide the window with a simple call to the ShowWindow function.

C#
ShowWindow(hwndOrb, SW_HIDE);

The P/Invoke declaration for this function is straightforward and doesn't require any fancy modifications.

C#
[DllImport("user32.dll")] 
private static extern int ShowWindow(IntPtr hwnd, int command);

private const int SW_HIDE = 0;
private const int SW_SHOW = 1;

Conclusion

There are two keys to making this work. The first is the way in which we declare the FindWindowEx function. We use an IntPtr type instead of a string for the class name variable. The other key is found in the arguments we pass to this function. We pass in the hexadecimal code 0xC017 cast as an IntPtr for the class name. This causes this function to treat this variable as an ATOM rather than a class name, and this particular ATOM appears to correspond to the Start Globe. Additionally, we also pass null for the window title for internationalization purposes.. These things together allow us to retrieve a window handle for the Start Globe. This solution was inspired by some rather cryptic posts at the end of this thread: Hide Vista Start Orb.

I hope this simplified method of hiding the Start Globe on Vista and Windows 7 makes your programming tasks easier and more enjoyable.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder Crunch Magic
United States United States
I'm working on a website to help people find games they'll love. It's called Crunch Magic. Mathematical!

www.crunchmagic.com.

Comments and Discussions

 
BugIt doesn't work if you press Windows Key!!! Pin
Shahram H.Farmanesh6-Mar-15 21:17
Shahram H.Farmanesh6-Mar-15 21:17 
QuestionHide the Taskbar but no the Startmenu Button Pin
Rutkaf20-Oct-13 16:03
Rutkaf20-Oct-13 16:03 
GeneralMy vote of 5 Pin
RobDaGoth17-Jul-12 4:51
RobDaGoth17-Jul-12 4:51 
GeneralA safer way Pin
Frank_Cheng23-Jul-10 12:01
Frank_Cheng23-Jul-10 12:01 
GeneralSimple way o kill the language dependence : ) Pin
pablomartin16-Jul-10 1:13
pablomartin16-Jul-10 1:13 
GeneralRe: Simple way o kill the language dependence : ) Pin
Waylon Flinn20-Jul-10 8:59
Waylon Flinn20-Jul-10 8:59 
Questionprobing the windows 7 taskbar Pin
Member 134471818-Jan-10 5:19
Member 134471818-Jan-10 5:19 
GeneralDon't work in localized Windows 7 Pin
arnischwarz23-Aug-09 0:14
arnischwarz23-Aug-09 0:14 
GeneralRe: Don't work in localized Windows 7 Pin
pablomartin16-Jul-10 1:14
pablomartin16-Jul-10 1:14 
GeneralRe: Don't work in localized Windows 7 Pin
arnischwarz7-Aug-10 5:28
arnischwarz7-Aug-10 5:28 
GeneralRe: Don't work in localized Windows 7 Pin
János Továbbító15-Sep-12 6:21
János Továbbító15-Sep-12 6:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.