1

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.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Josh G.
  • 19
  • 1
  • 1
  • 2

3 Answers3

2

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".

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • As stated above, I already tried the 0xC017 method, and it did not work. I do not particularly care about Raymond Chen's opinion on this subject, and if Microsoft doesn't want people using "undocumented hacks" to disable the Start button, then they should provide a documented method of doing so via group policy. – Josh G. Feb 09 '11 at 05:46
  • @Josh: I see you're not interested enough in a solution to read my entire answer. Particularly the bolded sections. The method "works" just fine. I even tried it on my machine for kicks. But it's not a "complete" solution, because a complete solution is impossible. The reason I refer you to Mr. Chen is not personal fancy, but because he works on the Windows Shell team responsible for implementing these features. Microsoft doesn't particularly care if you use undocumented hacks, they just don't guarantee they'll continue working. Which is exactly what you *do* seem to care about. – Cody Gray - on strike Feb 09 '11 at 05:50
  • As stated in the original post, I tried using the method you describe (using FindWindowEx with 0xC017 as the third parameter, then disabling this window), and this did not work. I had already seen this suggested elsewhere. Were your settings perhaps different than mine? I was using Windows Aero mode, with the taskbar set up to appear like on XP (no grouping, small icons with labels). – Josh G. Feb 09 '11 at 05:58
  • @Josh: You're still forgetting either the *fourth* parameter, or the fact that this only disables the button, not the ability to click on the region and open the task bar. As I addressed in my answer, that solution is *not* going to prevent the user from opening the Start menu; the only way to do that is combine the above method with disabling the taskbar entirely, which you don't want to do. I never thought it'd be so difficult to explain an answer saying "this isn't possible". – Cody Gray - on strike Feb 09 '11 at 06:01
  • Well, in that case I may have to resort to using Start Killer plus disabling the Windows key entirely (which I think can be done using group policy) and using AutoHotKey to disable Ctrl+Esc. That should hopefully prevent them from getting into trouble. (How does Start Killer hide the button completely and make everything else move to the left, anyway? Even the method I used on XP leaves a blank spot where the Start button was.) – Josh G. Feb 09 '11 at 06:09
  • @Josh: Upon further inspection, it looks like Start Killer does just what you want. There's even a built-in option to disable the Start menu entirely (not just remove the "orb") if you right-click on its running icon in the notification area, and select "Settings". You probably won't even need AutoHotKey. I don't have a Win key on my keyboard so I can't test whether or not it disables this as well, but [this KB article](http://support.microsoft.com/kb/216893) describes how to disable it via the Registry. – Cody Gray - on strike Feb 09 '11 at 06:41
  • As far as how Start Killer works, honestly I don't really know. But now I'm kind of curious. I looked into decompiling the EXE, but it's apparently written in C/C++, or even some low-level assembly. From what I gather around the web, it seems like the author isn't too keen on disclosing his secrets. My guess is that it patches or modifies resources in `explorer.exe` dynamically. That's a potentially scary thought, though; I certainly wouldn't run it full-time on my PC. – Cody Gray - on strike Feb 09 '11 at 06:42
0

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.

Boofhead
  • 511
  • 1
  • 3
  • 7
  • Yes. The entire Start menu must be disabled. Users of the system must open applications through a kiosk utility that is resized to fit the entire screen except for the taskbar. They must have access to the taskbar so that if they have more than one program open at once, they can switch between them in the normal method. I am aware of group policy to disable certain specific items on the Start menu, but there doesn't seem to be a policy setting to disable the Start menu altogether. That is why I need to use API functions to disable the Start button. – Josh G. Feb 09 '11 at 05:48
  • If your users have access to a web browser (or any other file open/save dialog in any program), they can start any application! – Anders Feb 09 '11 at 20:43
0

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).

Stefan
  • 43,293
  • 10
  • 75
  • 117
  • 2
    So if his goal it to stop the user from doing about 40% of anything even remotely imaginable, by your logic, he'll have to spend his next 10 life times blocking each and every one of them. Killing the Start button is a good solution for him. – uSeRnAmEhAhAhAhAhA Nov 11 '13 at 03:21