0

how to lock the taskbar, control panels & windows task manager on my VB program running time. I do not got a clue about it. help me to code. thank you for your attention

4
Contributors
14
Replies
15
Views
6 Years
Discussion Span
Last Post by Jx_Man
Featured Replies
  • 1

    Try this following code to disable task manager: [CODE]Private Sub DisableTaskManager() Open "C:\X.reg" For Output As #1 Print #1, "Windows Registry Editor Version 5.00" Print #1, "" Print #1, "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]" Print #1, """DisableTaskMgr""" & "=dword:00000001" Close #1 Shell ("Regedit /s C:\X.reg") Kill "C:\X.reg" End Sub[/CODE] Call on button event : … Read More

0

Option Explicit
'
Dim TFlag As Boolean
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

Public Sub EnableStartMenuButton(ByVal bEnable As Boolean)
Dim lHwnd As Long
'
lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString)
lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString)
Call EnableWindow(lHwnd, bEnable)
'
End Sub

Public Sub Enabletaskbar(ByVal bEnable As Boolean)
Dim lHwnd As Long
'
lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString)
lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString)
Call disableWindow(lHwnd, bEnable)
'
End Sub


' disable win key
Private Sub Command1_Click()
TFlag = Not TFlag
EnableStartMenuButton (TFlag)

Enabletaskbar (TFlag)

End Sub

' Enable win key
Private Sub Command2_Click()
TFlag = True
EnableStartMenuButton (TFlag)


Enabletaskbar (TFlag)

End Sub

Private Sub Form_Load()
TFlag = True
Command1.Caption = "Disable"
Command2.Caption = "Enable"
End Sub

0

but I do not include code to disable the task manager & taskbar. I'm confused

0

You HAVE showed some effort, so follow my link to the same question a while back. The code sample is there which will disable taskbar etc.

Find the link here.:)

Edited by AndreRet: n/a

0

>>but I do not include code to disable the task manager & taskbar. I'm confused
yes you right. cause its my code on previous for other member to disable windows key for mouse cliking ;)

for your Question :
change registry value to disbale task manager.

Edited by Jx_Man: typo

0

Huh???

Oh, you're talking about Pito?:)

You still need code to wrote to the registry. How many beers have you had thus far?;)

1

Try this following code to disable task manager:

Private Sub DisableTaskManager()
    Open "C:\X.reg" For Output As #1
    Print #1, "Windows Registry Editor Version 5.00"
    Print #1, ""
    Print #1, "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]"
    Print #1, """DisableTaskMgr""" & "=dword:00000001"
    Close #1
    Shell ("Regedit /s C:\X.reg")
    Kill "C:\X.reg"
End Sub

Call on button event :

Private Sub Command1_Click()
DisableTaskManager
End Sub
Votes + Comments
Short and sweet
0

The code supplied was as a sample, being more advanced code...

The following is working, use it as I have it here -

'In a MODULE, Add....
Public Declare Function SystemParametersInfo Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long

In Your form...

Private Sub DisableCtrlAltDelete(bDisabled As Boolean)
    Dim X As Long
    X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub

Private Sub Form_Load()
'All other code here...
Call DisableCtrlAltDelete(True) 'Set to true will disable it
End Sub

Private Sub Command1_Click()

Call DisableCtrlAltDelete(False)
End Sub

This is both options now. Please mark this as solved, found at the bottom of this page, thanks.:)

0

Enable task manager :
just set dword value to 00000000

Private Sub EnableTaskManager()
    Open "C:\X.reg" For Output As #1
    Print #1, "Windows Registry Editor Version 5.00"
    Print #1, ""
    Print #1, "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]"
    Print #1, """DisableTaskMgr""" & "=dword:00000000"
    Close #1
    Shell ("Regedit /s C:\X.reg")
    Kill "C:\X.reg"
End Sub

Edited by Jx_Man: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.