Hide Start Menu-VBForums
Results 1 to 8 of 8

Thread: Hide Start Menu

  1. #1

    Thread Starter
    Member inthecrossfire's Avatar
    Join Date
    Aug 2001
    Posts
    52

    Question Hide Start Menu

    I can't find the API for hiding the start menu. Any help?

    And yes it does have a use.

  2. #2
    Lively Member
    Join Date
    Feb 2002
    Posts
    69
    Do you want to hide the start button or the whole start menu?

    You can hide the start button by using this simple code:

    Option Explicit
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    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 ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Private Const SW_HIDE = 0
    Private Const SW_SHOW = 5
    Dim Taskbar As Long
    Dim StartButton As Long
    Private Sub Command1_Click()
    ShowWindow StartButton, SW_SHOW
    End Sub

    Private Sub Command2_Click()
    ShowWindow StartButton, SW_HIDE
    End Sub

    Private Sub Form_Load()
    Command1.Caption = "show start button"
    Command2.Caption = "hide start button"

    Taskbar = FindWindow("Shell_TrayWnd", vbNullString)
    StartButton = FindWindowEx(Taskbar, ByVal 0&, "BUTTON", vbNullString)
    End Sub

  3. #3
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335
    VB Code:
    1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    2. Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hwndParent As Long, ByVal hwndChildAfter As Long, ByVal lpszClass As Any, ByVal lpszWindow As Any) As Long
    3. Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    4.  
    5. Private Function HideSButton()
    6.     Dim OurParent As Long
    7.     Dim OurHandle As Long
    8.     OurParent& = FindWindow("Shell_TrayWnd", "")
    9.     OurHandle& = FindWindowEx(OurParent&, 0, "Button", vbNullString)
    10.     ShowWindow OurHandle&, 0
    11.  
    12. End Function
    13.  
    14. Private Function ShowSButton()
    15.     Dim OurParent As Long
    16.     Dim OurHandle As Long
    17.     OurParent& = FindWindow("Shell_TrayWnd", "")
    18.     OurHandle& = FindWindowEx(OurParent&, 0, "Button", vbNullString)
    19.     ShowWindow OurHandle&, 5
    20.  
    21. End Function
    22.  
    23. Private Sub Command1_Click()
    24.     Call HideSButton
    25. End Sub
    26.  
    27. Private Sub Command2_Click()
    28.     Call ShowSButton
    29. End Sub
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  4. #4
    New Member
    Join Date
    Feb 2002
    Posts
    2

    Angry

    That code only hides the start button. You can still get the start menu to pop up. Is there any way of hiding a menu????
    if you have the quickstart menu on the toolbar, if you drag it onto or over where the start button is meant to be it brings up the start menu!!!!!
    with the quick start menu not there it works nicely!!!

  5. #5
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378
    Well I don`t know what you are up to with these codes hiding the START button but if you were trying to prevent a user from having access to the Start menus then that won`t really work cause if you hit the Windows button on your keyboard, the Start menus will still show up...
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  6. #6
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335
    Ok, then try disabling the Start Menu.
    VB Code:
    1. 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
    2. Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
    3.  
    4. Private Sub Command1_Click()
    5. Static bEnabled As Boolean
    6.     Dim lhWnd As Long
    7.  
    8.     lhWnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString)
    9.     lhWnd = FindWindowEx(lhWnd, 0&, "Button", vbNullString)
    10.     Call EnableWindow(lhWnd, bEnabled)
    11.     bEnabled = Not bEnabled
    12.  
    13. End Sub
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  7. #7
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    Hi

    How can i change the Caption of start button

    With the above code i tried using

    SetWindowText(OurHandle&, "Pradeep")
    SendMessage(OurHandle&, &HF, ByVal 0&, ByVal 0&)

    But it dint work.. Can anybody help me out..

    Pradeep
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

  8. #8
    New Member
    Join Date
    Nov 2012
    Posts
    1

    Re: Hide Start Menu

    How can I get this code to work in VB 2010?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.