By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,459 Members | 1,472 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,459 IT Pros & Developers. It's quick & easy.

Lock taskbar & Start button

P: n/a
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
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

Nov 16 '05 #2

P: n/a
Thanks, worked perfect....

Chris

"Crouchie1998" <Cr**********@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
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

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.