This FAQ will show you some example code on how to enable & disable objects
[color green]'First you need to declare the API functions you will be using{[/color]
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
[color green]'};[/color]
[color green]'This function will get the handle of the start menu and enable it or disable it depending on the value of the Status value[/color]
Private Function Enable_WindowsXP_StartButton(Status as Boolean)
Dim zhWnd As Long
zhWnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString): zhWnd = FindWindowEx(zhWnd, 0&, "Button", vbNullString)[color green]'This uses the class of the object to find the objects handle[/color]
Call EnableWindow(zhWnd, Status)[color green]'Runs the API to enable or disable the object[/color]
End Function
[color green]'Use The Above Function In The Manner Below[/color]
Call Enable_WindowsXP_StartButton(False)[color green] 'To Disable Start Menu[/color]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.