How can I disable the Start button (but not the Taskbar) on Windows 7?

32.6k views Asked by At

On Windows XP, it was possible to disable the Start button with the following code:

hTray = FindWindow (TEXT("Shell_TrayWnd"), NULL);
if (hTray)
{
    hStartButton = FindWindowEx(hTray, NULL, TEXT("Button"), NULL);
    if (hStartButton) ShowWindow(hStartButton, FALSE);
}

For a public-access computer configuration, I need to be able to do this on Windows 7. The Start button must be disabled (not just hidden), and the remainder of the Taskbar must still be visible and usable. Hiding the Taskbar along with the Start button is not an option. Running full-screen is not an option. Using "Start Killer" won't work because it doesn't actually disable the Start button, just hides it (users can still use hotkeys to pull up the Start menu).

I have already tried the method that uses FindWindowEx with 0xC017 as its third parameter and then tries to disable that window. It doesn't work. That method only works if the whole Taskbar is disabled first. What I need is a method that only disables the Start menu, just like the code I reproduced above does in XP.

Any help is greatly appreciated.

3

There are 3 answers

7
Cody Gray - on strike On

The "correct" version for Windows 7 is as shown below:

HWND hStartBtn = FindWindowEx(NULL, NULL, MAKEINTATOM(0xC017), TEXT("Start"));
if (hStartBtn != NULL)
{
    ShowWindow(hStartBtn, FALSE);
}

However, this only disables the button, meaning you won't get the glow or other effects by hovering your mouse cursor over it. You can still click the button region on the taskbar to open the menu. Apparently, the click handler is now implemented in the taskbar window itself, not as part of the separate Start button. That's why you have to disable the entire taskbar first, and consequently why most of the solutions you've found online do precisely that.

However, it looks like the "Start Killer" application now has functions to disable the most common hotkeys that trigger the Start menu, namely Ctrl+Esc and the Windows key. You'll find those options by launching the software, right-clicking on its icon in the taskbar, and selecting "Options" from the menu. You can also edit the Registry to disable the Windows key, as described in this knowledge base article. If you wanted to implement this same functionality yourself through code, the only solution would be a low-level keyboard hook that trapped the keypress events that are responsible and discarded them.

Undocumented hacks like this one are given to breaking with newer versions of Windows. I imagine that Raymond Chen would chuckle and say something like "I told you so". Hacking the Windows interface is a fool's errand. Or, as you say several times in the question, "is not an option".

2
Boofhead On

IS there anything in particular about the start menu you need to disable? You may be able to do the same via policy settings or various other file permissions.

1
Stefan On

Use one of the available group policies listed here.

You did not mention why you want to disable the start button. If you think about what exactly it is that you don't want your users to do instead of telling us the solution you picked for it (i.e., "disable the start button"), you might come up with a much better solution.

For example, if you want to prevent users from changing certain settings, block that, not the start button! Or if you don't want them to see all the installed apps, hide those apps instead of the start button! Or...

(I hope you see my point here).