Disabling the Windows Start Button


This small code sample shows how to disable the Start Menu button through code, simply paste it into a BAS module and use :


'
' Paste this into a Code Mode (BAS)
'
option Explicit
'
private Declare Function FindWindowEx Lib "user32" _
        Alias "FindWindowExA" (byval hWnd1 as Long, byval hWnd2 as Long, _
        byval lpsz1 as string, byval lpsz2 as string) as Long
'
private Declare Function EnableWindow Lib "user32" (byval hwnd as Long, _
        byval fEnable as Long) as Long

public Sub EnableStartMenuButton(byval bEnable as Boolean)
'
' Don't forget to re-enable it !
'
    Dim lHwnd as Long
' 
    lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString)
    lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString)
    Call EnableWindow(lHwnd, bEnable)
'
End Sub
'
'

Make sure that you remember to re-enable the start menu button at some point or it could get very frustrating !



Comments

  • **** good

    Posted by droove2000 on 06/08/2005 01:34am

    this thing is awesome................ can anybody xplain the code to me ?????????

    Reply
  • it doesn't work.

    Posted by Arren211314 on 04/05/2004 12:33am

    this function can't disable the "windows" key, when you press it, the start menu shows always. so will you have a better function.

    Reply
  • Disable using regedit - figure a way out to put the code in registry

    Posted by Legacy on 08/11/2003 12:00am

    Originally posted by: SELVARAJAN

    Check out regedit.com to get reg key to disable start button.It's that simple.

    Reply
  • Not Working With Keyboard

    Posted by Legacy on 07/24/2003 12:00am

    Originally posted by: Vinay Verma

    When Keyboard Windows Button Is Pressed .
    It Is Not Working

    Reply
  • NONE

    Posted by Legacy on 07/01/2002 12:00am

    Originally posted by: amit

    iwant to disable restore and MAXIMISE BUTTONS
    WHILE RUNNING ANY FORM ..IN VISUAL BASIC

    Reply
  • I want the code for enabling the start button

    Posted by Legacy on 03/23/2002 12:00am

    Originally posted by: kavita

    I want the code for enabling the start button

    Reply
  • Discabling the windows start button

    Posted by Legacy on 01/14/2002 12:00am

    Originally posted by: Okosodo Evans

    The writter of this code is a straight line drawn by God!Please also teach me how to use windos API or otherwise to to disable all control key ( like CTRL-ESC ,
    CTRL-ALT_DEL ).

    Reply
  • Nice trick . But its working when using Ctl + Space

    Posted by Legacy on 08/28/2001 12:00am

    Originally posted by: Sanal Nambiar

    .I got that one. Really Nice. Plz send me the trick to disable ctl+alt+del , alt+tab + ctl+space and all keys in the key board. usin . vb with windows api. (VB) PLz. my request.

    Reply
  • Nifty

    Posted by Legacy on 08/21/2001 12:00am

    Originally posted by: Scott

    Great for messing with coworkers :)

    Reply
  • It worked wonderful

    Posted by Legacy on 07/11/2001 12:00am

    Originally posted by: Mohsin Rauf

    I never thought it'd be that easy, now im looking forward to make dependent upon uid of nt4.

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • With the average hard drive now averaging one terabyte in size, the fallout from the explosion of user-created data has become an overwhelming volume of potential evidence that law-enforcement and corporate investigators spend countless hours examining. Join Us and SANS' Rob Lee for our 45-minute webinar, A Triage and Collection Strategy for Time-Sensitive Investigations, will demonstrate how to: Identify the folders and files that often contain key insights Reduce the time spent sifting through content by …

Most Popular Programming Stories

More for Developers

RSS Feeds