Getting rid of the Start button in Windows 8.1

September 15, 2013

Windows 8.1 brings back the famous Start button, but alas – it’s not the good Start button from Windows 7. It’s just yet another way to get to the new Home screen. This makes the Start button (at least for me) completely useless, as there are already several ways to get to the Home screen (Windows key on the keyboard, mouse moved to the bottom left corner, touch devices can press the hardware Start button, the Charms bar has a Start button…).

There are utilities that can simulate the old Windows 7 Start button, if I don’t have such a utility, at least I’d like to get rid of the button, since it takes valuable space on the task bar. But how?

My first guess would be that the Start button is a Window, so it has an HWND. Let’s find it and then get rid of it by closing it or hiding it. How can we find the Start button’s HWND? We turn to our trusted tool, Spy++.

Search (in Windows, if you have Visual Studio or the Windows SDK installed) for “Spy++” or “Spyxx” and run the tool (at this point it doesn’t matter if you run the 32 or 64 bit version). This is how the tool looks like when run:

image

We need to find the HWND of the Start button. For this we’ll open the Spy menu and select Find Window…. A small window appears with a “bullseye” crosshair which we can drag on top of any window to get some more information:

image

Click and drag the finder tool over the Start button and then release the mouse button:

image

(The Handle value itself may be different on your system). Click OK to see the properties of that Window:

image

Clearly, the Window caption is “Start”, so we got our man, so to speak. However, the caption “Start” may be localized, and perhaps it’s called something else on a different UI regional settings. To find the Start button in code, we’ll need something more definite. This is the Class name of the Start button’s Window, which we can find in the Class tab:

image

In classic Windows, every window belongs to a class. There are predefined classes like “button”, “listbox” and others, but for custom windows, new classes need to be created, as was clearly done with the Start button.

Next, we need to find out the relationship of the Start button’s window to the desktop, so we can find it. Clicking on the Synchronize button shows the Window’s position in the parent/child hierarchy:

SNAGHTML28304f9

Here we can see that the Start button is a child of a window with a class name of “Shell_TrayWnd”, which is in itself a direct child of the desktop.

Let’s start coding. Create a new Visual Studio C++ Win32 project (a normal EXE or a console app) (you can use any VS version for this (I’ve avoided C++11 specific features). Add an #include for <windows.h>.

In the main (or WinMain) function, we’ll get to the Start button in two steps: first, find that “Shell_TrayWnd” window and then the Start button itself:

  1. HWND hDesktop = ::FindWindow(L"Shell_TrayWnd", nullptr);
  2. HWND hStart = ::FindWindowEx(hDesktop, NULL, L"Start", nullptr);

FindWindow looks for a top-level window (we can verify with Spy++ that the “Shell_TrayWnd” indeed is top level, but examining the “Windows” tab in the properties window of Spy++. FindWindowEx looks for a child window, given a parent window. Note that both functions can search for a specific class name, which is what we need. The functions can also search by window title, but that’s too brittle for most purposes, certainly for ours, as the “Shell_TrayWnd” window has no caption.

if we find the Start button, we can make it go away by destroying it (politely) or by simply hiding it (both approaches work equally well):

  1.     if(hStart) {
  2. //        ::SendMessage(hStart, WM_CLOSE, 0, 0);
  3.         ::ShowWindow(hStart, SW_HIDE);
  4.     }

I’ve commented out the destroying option.

When executed, this little app gets rid of the Start button!

Unfortunately, we’re not done yet. The button is gone, but it left out empty space, which we want to use for the TaskBar. We need to move a sibling window of the Start button, with a class name of “ReBarWindow32” to the left – this is the window that holds the TaskBar itself. We can verify this with Spy++, and I leave that as an exercise to the reader.

So, we continue with a similar searching technique to move the ReBar window like so:

  1. HWND hReBar = FindWindowEx(hDesktop, nullptr, L"ReBarWindow32", nullptr);
  2. if(hReBar) {
  3.     RECT rc;
  4.     ::GetWindowRect(hReBar, &rc);
  5.     ::SetWindowPos(hReBar, NULL, 0, 0, rc.right, rc.bottom – rc.top, SWP_NOZORDER | SWP_NOACTIVATE);

We locate the window, get it’s bounds into a RECT structure, and move it to the left to position 0,0. Note that if the TaskBar is docked to the left or right (as some people prefer), we’d have to change our code accordingly. I’ll leave that as another exercise for the reader.

Now we’re done, or at least it seems so:

image

Not quite, unfortunately…

Clicking on the system tray down arrow causes the taskbar to be restored to its former glory… including the Start button. It will not actually show, as it was hidden or closed, but the empty space returns.

What can we do about that? We need to write a hook – which we will in the second part of this post…

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

one comment

  1. sanjayMay 18, 2014 ב 07:32

    Hi Pavel
    When i hover the mouse to the bottom left of screen the start button is becoming visible
    I tried adding a wm_mouse_ll but its working any suggestions

    Reply