| | | Junior Member
       
Group: Forum Members Last Login: 2/6/2007 12:42:45 AM Posts: 15, Visits: 20 |
| Dear friends
I want to disable the start button in the taskbar. I have already gone through many API function but I cann't root out this problem. What may be the possiblity answer of this question. Thanking you |
| | | | 
Forum Guru
       
Group: Forum Members Last Login: 5/20/2006 7:21:20 PM Posts: 189, Visits: 25 |
| If your using XP, im pretty sure you cant... but if its not XP, do a search on the main site. It should return something...
DOS
 email me |
| | | | 
Forum God
       
Group: Forum Members Last Login: 1/27/2008 2:50:27 PM Posts: 334, Visits: 16 |
| I found this code on http://abstractvb.com/code.asp?F=53&P=1&A=970 To hide the start button use: (make a form with 2 command buttons, command1 and command2) Option Explicit
Private Declare Function ShowWindow Lib "user32" _ (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long 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
Sub StartButton(blnValue As Boolean) Dim lngHandle As Long Dim lngStartButton As Long
lngHandle = FindWindow("Shell_TrayWnd", "") lngStartButton = FindWindowEx(lngHandle, 0, "Button", vbNullString)
If blnValue Then ShowWindow lngStartButton, 5 Else ShowWindow lngStartButton, 0 End If End Sub
Private Sub Command1_Click() StartButton True End Sub
Private Sub Command2_Click() StartButton False End Sub |
I then edited the above code to disable start button:Option Explicit
Private Declare Function EnableWindow Lib "user32" _ (ByVal hwnd As Long, ByVal fEnable As Long) As Long 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
Sub StartButton(blnValue As Boolean) Dim lngHandle As Long Dim lngStartButton As Long
lngHandle = FindWindow("Shell_TrayWnd", "") lngStartButton = FindWindowEx(lngHandle, 0, "Button", vbNullString)
If blnValue Then EnableWindow lngStartButton, 1 Else EnableWindow lngStartButton, 0 End If End Sub
Private Sub Command1_Click() StartButton True End Sub
Private Sub Command2_Click() StartButton False End Sub |
Milo  |
| | | | Forum God
       
Group: Forum Members Last Login: 7/15/2011 3:57:36 PM Posts: 371, Visits: 208 |
| What about access to the start button from the keyboard?
|
| | | | 
Forum God
       
Group: Forum Members Last Login: 1/27/2008 2:50:27 PM Posts: 334, Visits: 16 |
| Put this in a module:Option Explicit
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long Public Const HC_ACTION = 0 Public Const WM_KEYDOWN = &H100 Public Const WM_KEYUP = &H101 Public Const WM_SYSKEYDOWN = &H104 Public Const WM_SYSKEYUP = &H105 Public Const VK_STARTKEY = &H5B
Public Const WH_KEYBOARD_LL = 13
Public Type KBDLLHOOKSTRUCT vkCode As Long scanCode As Long flags As Long time As Long dwExtraInfo As Long End Type
Dim hhkLowLevelKybd As Long Dim p As KBDLLHOOKSTRUCT
Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Dim fEatKeystroke As Boolean If (nCode = HC_ACTION) Then If wParam = WM_KEYDOWN Or wParam = WM_SYSKEYDOWN Or wParam = WM_KEYUP Or wParam = WM_SYSKEYUP Then CopyMemory p, ByVal lParam, Len(p) fEatKeystroke = p.vkCode = VK_STARTKEY End If End If If fEatKeystroke Then LowLevelKeyboardProc = -1 Else LowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal lParam) End If End Function |
This in Form_Load: | hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0) |
And this in Form_Unload: UnhookWindowsHookEx hhkLowLevelKybd hhkLowLevelKybd = 0 |

Milo  |
| | | | Forum Newbie
       
Group: Forum Members Last Login: 11/28/2004 7:38:00 AM Posts: 3, Visits: 1 |
| | |
|
|