Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » Classic Visual Basic (VB 6 or earlier) » General Visual Basic » How to Disable start button in the task bar


How to Disable start button in the task barExpand / Collapse
Author
Message
Posted 11/27/2004 8:34:53 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior 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

Post #6395
Posted 11/27/2004 10:27:54 AM


Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum 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
Post #6399
Posted 11/27/2004 7:31:01 PM


Forum God

Forum GodForum GodForum GodForum GodForum GodForum GodForum GodForum 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 LongAs Long
    
Private Declare Function FindWindow Lib "user32" _
    Alias "FindWindowA" (ByVal lpClassName As String, _
    ByVal lpWindowName As StringAs Long
    
Private Declare Function FindWindowEx Lib "user32" _
    Alias "FindWindowExA" (ByVal hWnd1 As Long, _
    ByVal hWnd2 As Long, _
    ByVal lpsz1 As String, _
    ByVal lpsz2 As StringAs 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 LongAs Long
    
Private Declare Function FindWindow Lib "user32" _
    Alias "FindWindowA" (ByVal lpClassName As String, _
    ByVal lpWindowName As StringAs Long
    
Private Declare Function FindWindowEx Lib "user32" _
    Alias "FindWindowExA" (ByVal hWnd1 As Long, _
    ByVal hWnd2 As Long, _
    ByVal lpsz1 As String, _
    ByVal lpsz2 As StringAs 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

Milo!

Post #6405
Posted 11/27/2004 8:03:54 PM
Forum God

Forum GodForum GodForum GodForum GodForum GodForum GodForum GodForum 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?



TallOne
Post #6406
Posted 11/28/2004 5:06:05 AM


Forum God

Forum GodForum GodForum GodForum GodForum GodForum GodForum GodForum 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 LongAs Integer
Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As LongAs 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 LongAs 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 LongAs 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

Milo!

Post #6411
Posted 11/28/2004 9:54:15 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

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

hi

sometime back i tried it in my w2k pro & it worked, however it crashed my cousin's pc. anycase its fingering with windows registry; so use it with care & at ur own risk

http://www.winguides.com/registry/display.php/905/

Post #6412
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Admin, Mod, Mark, Keithuk

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 12:14am