Hello fellas, recently i hit upon an to develop a small program to lock screen.

As a part of it, I need to lock taskbar from functioning, i.e should not show up when pressed Start Button, or Ctrl + esc or not even Ctrl + alt + Del.

I dont know much of libraries or other way to do it.

Suggestions are always appreciated.

thanks :-)


You can try this;

  Private 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
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
    Const SWP_HIDEWINDOW = &H80
    Const SWP_SHOWWINDOW = &H40
    Dim taskBar As Integer

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Button1.Text = "Hide" Then
            Debug.Write(SetWindowPos(taskBar, 0&, 0&, 0&, 0&, 0&, SWP_HIDEWINDOW))
            Button1.Text = "Show"
            Debug.Write(SetWindowPos(taskBar, 0&, 0&, 0&, 0&, 0&, SWP_SHOWWINDOW))
            Button1.Text = "Hide"
        End If
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        taskBar = FindWindow("Shell_traywnd", "")
    End Sub

@Luc001: Is that code for hiding taskbar or locking it comletely.

I need to lock a taskbar and it should not respond even if start button is pressed or should not popup the Windows Task Manager.

Appreciate your effort. Let me try code given by you.


Hi Rahul47,
I am Jenifer, owner of Software Collection.
I didn't understand what you really wanting to learn?
I mean do you want to enable the auto hide feature of taskbar?
Then you can simple do it by going to taskbar properties and check the auto hide option.
But I don't think so you are looking for that simple solution :-P

@Jenifer Sarah: Yea, you are right, am not looking for hiding feature.

I am actually writing an application which will lock screen when it's opened, Like a Child Lock in TV.
It will have only a small login panel, and will cover whole desktop including taskbar and start button.

But the catch is...start button is easily accessible through Start. . or Ctrl + Esc. Also Taskbar is brings up the form on hitting start button. Ctrl + Alt + Delete will also bring up Task Manager which should not. Ctrl + Tab will switch applications.

Conclusion: All controls to return to desktop should be locked and password protected.

Thanks for your concern.

@Jenifer Sarah: Your link of Software Collection is directed to a dead page.
Please check again.