Lock taskbar & Start button

  • Thread starter news.microsoft.com
  • Start date
N

news.microsoft.com

I'm trying to write a program that will lock down the system. I want to
hide the start button and taskbar. I found code using ShowWindow &
FindWindow but they fail to work.

Butttonhwnd = FindWindow("Shell_TrayWnd", "")
Butttonhwnd = FindWindowEx(Butttonhwnd, 0, "Button", Nothing)
ShowWindow(Butttonhwnd, BUT_HIDE)

Anyone have any idea on how to this?

Chris
 
G

Guest

Start a new Windows application & add 3 buttons to it

Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Integer
Declare 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

Public Const SWP_HIDEWINDOW = &H80
Public Const SWP_SHOWWINDOW = &H40

Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnShow.Click
ShowTaskBar()
End Sub

Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnHide.Click
HideTaskBar()
End Sub

Public Sub ShowTaskBar()
Dim intReturn As Integer = FindWindow("Shell_traywnd", "")
SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
End Sub

Public Sub HideTaskBar()
Dim intReturn As Integer = FindWindow("Shell_traywnd", "")
SetWindowPos(intReturn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnExit.Click
ShowTaskBar()
Application.Exit()
End Sub

Private Sub frmTaskbar_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
ShowTaskBar()
End Sub

------------------------------

I have called my form 'frmTaskbar'

Button 1 = btnShow
Button 2 = btnHide
Button 3 = Exit

---------------------------------------------

On form closing I have called showtaskbar because I you don't want it
invisible when you close the application.

I hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top