I can't find the API for hiding the start menu. Any help?
And yes it does have a use.
Printable View
I can't find the API for hiding the start menu. Any help?
And yes it does have a use.
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
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 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 Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Function HideSButton() Dim OurParent As Long Dim OurHandle As Long OurParent& = FindWindow("Shell_TrayWnd", "") OurHandle& = FindWindowEx(OurParent&, 0, "Button", vbNullString) ShowWindow OurHandle&, 0 End Function Private Function ShowSButton() Dim OurParent As Long Dim OurHandle As Long OurParent& = FindWindow("Shell_TrayWnd", "") OurHandle& = FindWindowEx(OurParent&, 0, "Button", vbNullString) ShowWindow OurHandle&, 5 End Function Private Sub Command1_Click() Call HideSButton End Sub Private Sub Command2_Click() Call ShowSButton End Sub
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!!!
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...:cool:
Ok, then try disabling the Start Menu.VB Code:
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 Private Sub Command1_Click() Static bEnabled As Boolean Dim lhWnd As Long lhWnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString) lhWnd = FindWindowEx(lhWnd, 0&, "Button", vbNullString) Call EnableWindow(lhWnd, bEnabled) bEnabled = Not bEnabled End Sub
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 :confused:
How can I get this code to work in VB 2010?
I know this is an old topic but I am having the problem of hiding the start button yet you can still click on it. Even if you disable it you can click on it.
Check out my code sample here: http://www.vbforums.com/showthread.p...rt-Menu-Button