CanisEsco
asked on
Disable Start Menu
I have an ACCESS XP application that is run on a public access machine. We want to prevent users from accessing the start menu/task manager whilst the application is running. Is there any VB.NET/VB6/Access XP API/Code or indeed a Systems Administration technique to prevent the start menu from being accessed ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use this in VBA... Dont forget to turn it back on :-)
http://www.programmershelp.co.uk/vbhidetask.php
http://www.programmershelp.co.uk/vbhidetask.php
This will hide the task bar from showing up.
Private Declare Unicode Function FindWindowW Lib "user32" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Integer
Private Declare Unicode Function SetWindowPos Lib "user32" (ByVal hWnd As Integer, _
ByVal hWndInsertAfter As Integer, _
ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, _
ByVal cy As Integer, ByVal wFlags As Integer) As Integer
Const TOGGLE_HIDE As Integer = &H80
Const TOGGLE_UNHIDE As Integer = &H40
Private hTaskWindow As Integer
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
hTaskWindow = FindWindowW("Shell_traywnd ", "")
End Sub
Private Sub cbHide_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles cbHide.Click
' This statement will hide the task bar until you enable it again
SetWindowPos(hTaskWindow, 0, 0, 0, 0, 0, TOGGLE_HIDE)
End Sub
Private Sub cbUnHide_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles cbUnHide.Click
' Enables the task bar again
SetWindowPos(hTaskWindow, 0, 0, 0, 0, 0, TOGGLE_UNHIDE)
End Sub
Hope this helps
Private Declare Unicode Function FindWindowW Lib "user32" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Integer
Private Declare Unicode Function SetWindowPos Lib "user32" (ByVal hWnd As Integer, _
ByVal hWndInsertAfter As Integer, _
ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, _
ByVal cy As Integer, ByVal wFlags As Integer) As Integer
Const TOGGLE_HIDE As Integer = &H80
Const TOGGLE_UNHIDE As Integer = &H40
Private hTaskWindow As Integer
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
hTaskWindow = FindWindowW("Shell_traywnd
End Sub
Private Sub cbHide_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles cbHide.Click
' This statement will hide the task bar until you enable it again
SetWindowPos(hTaskWindow, 0, 0, 0, 0, 0, TOGGLE_HIDE)
End Sub
Private Sub cbUnHide_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles cbUnHide.Click
' Enables the task bar again
SetWindowPos(hTaskWindow, 0, 0, 0, 0, 0, TOGGLE_UNHIDE)
End Sub
Hope this helps
My code will not display the task bar at all so don't forget to unhide it.
ASKER
How do we disable the key now. When I press the windows key on the keyboard, the Start Menu appears, how do we disable that pls.
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Messa ge, ByVal keyData As System.Windows.Forms.Keys) As Boolean
If msg.WParam.ToInt32() = CInt(Keys.LWin) Or msg.WParam.ToInt32() = CInt(Keys.RWin) Then
'nothing
Return True
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function 'ProcessCmdKey
If msg.WParam.ToInt32() = CInt(Keys.LWin) Or msg.WParam.ToInt32() = CInt(Keys.RWin) Then
'nothing
Return True
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function 'ProcessCmdKey
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Bob;
I would like to see a resolution on this question seeming the question has been answered.
Thanks;
Fernando
I would like to see a resolution on this question seeming the question has been answered.
Thanks;
Fernando
ASKER
The resolution that we used in the end was a mix of Ronald and Fernando's solution. We used the code from Ronald and the application from Fernando. I've increased and shared the points. The actual requirement at work had been forgotten about hence the reason for not closing. Cheers for the advise.
Hi flavo, i'll appreciatte if you can give an idea how to use your function code to disable the Windows keboard key.
thanks.
thanks.
ASKER