Solved

Disable Start button

Posted on 1998-12-10
5
232 Views
Last Modified: 2010-07-27
I found this code thats supposed to disable enable the start button but it does not work. What is wrong or I need code that works.

'to disable
Call EnableWindow(FindWindowEx(FindWindow("Shell_TrayWnd", ""), vbNull, "Button", ""), False)

'to enable
 Call EnableWindow(FindWindowEx(FindWindow("Shell_TrayWnd", ""), vbNull, "Button", ""), True)
   
This is the start button with the windows logo on the taskbar, and the keyboard.

Thank you Experts
 
0
Comment
Question by:fred12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 9

Expert Comment

by:Dalin
ID: 1449225
fred12,
Tray this:

Dim hWnd1 As Long

Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
       Const SWP_HIDEWINDOW = &H80
       Const SWP_SHOWWINDOW = &H40


'code for disable:
hWnd1 = FindWindow("Shell_traywnd", "")
Call SetWindowPos(hwnd1, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)

'and code for enable again:
Call SetWindowPos(hwnd1, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)

Regards
Dalin
0
 

Author Comment

by:fred12
ID: 1449226
Dalin sorry the code you provided hide/shows all of taskbar, Im looking for just the start button. Thank you
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 100 total points
ID: 1449227
Here you are:

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 EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long


Private Sub Command1_Click()
'to disable
Call EnableWindow(FindWindowEx(FindWindow("Shell_TrayWnd", ""), 0, "Button", ""), 0)

End Sub

Private Sub Command2_Click()
'to enable
Call EnableWindow(FindWindowEx(FindWindow("Shell_TrayWnd", ""), 0, "Button", ""), 1)
End Sub


0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1449228
Try this:
Dim hFw as long
hFw = FindWindow("Shell_TrayWnd", vbNullString)
hFw = FindWindowEx(hFw, 0,  "Button", vbNullString)
EnableWindow(hFw, FALSE)
0
 

Author Comment

by:fred12
ID: 1449229
:)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
to transfer string from C lanaguage to VBA 4 77
using web browser with BING 40 136
checkbox to hide entire section 10 60
how to loop through and process two columns in excel 8 48
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question