I heard that using VB 6.0 I can disable the start button. But I've search to found what code to be put but unfortunately i cannot found one. I also know that code for win98 differ from XP OS... So pls some one teach me... Thanks a lot..

Recommended Answers

All 3 Replies


Open a New Project. Place A Command Button on the Form.
Copy and Paste this Code Form Level:

Option Explicit
Dim TFlag as Boolean
Private Declare Function FindWindowEx Lib "user32" _
       Alias "FindWindowExA" (byval hWnd1 as Long, byval hWnd2 as Long, _
byval lpsz1 asstring, byval lpsz2 asstring) as Long
Private Declare Function EnableWindow Lib "user32" (byval hwnd as Long, _
byval fEnable as Long) as Long
Public Sub EnableStartMenuButton(byval bEnable as Boolean)
   Dim lHwnd as Long
   lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString)
   lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString)
   Call EnableWindow(lHwnd, bEnable)
End Sub

Write This Code In Form Load And Command Click Event:

Private Sub Form_Load()
    TFlag = True
    Command1.Caption = "Disable"
End Sub
Private Sub Command1_Click()
    TFlag = Not TFlag
    Command1.Caption = "Enable"
    EnableStartMenuButton (TFlag)
End Sub

Dont Ever Forget To Enable Back the Start Button. :)


commented: That's a good one qveenie! +1

Dont Ever Forget To Enable Back the Start Button. :)

To help you to not forget you could put the following code in the Form_Unload event.

Private Sub Form_Unload(Cancel as Integer)
TFlag = True
EnableStartMenuButton (TFlag)
End Sub

This will automatically enable the Start button when you unload the form.

To the both of you, I really appreciate it.. Thanks to the both of you and happy programmming....


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.