|
-
Oct 7th, 2006, 01:32 PM
#1
Thread Starter
Junior Member
-
Oct 7th, 2006, 01:44 PM
#2
Re: Disable ctrl+alt+del in vb6 for windows xp
You may forget about disabling CTRL+ALT+DEL all at once - cannot be done.
Some other special key combination can be disabled: here is an article for you.
btw, Welcome to Forums!
-
Oct 7th, 2006, 09:23 PM
#3
Hyperactive Member
Re: Disable ctrl+alt+del in vb6 for windows xp
VB Code:
'--------This example only blocks task manager, not the actual keypress of Ctrl-Alt-Delete-----
Dim blockTaskMgrFile As Integer
Private Sub Command1_Click()
blockCAD
End Sub
Private Sub Command2_Click()
unBlockCAD
End Sub
Private Function blockCAD()
'Open up the taskmanager exe and lock it. It cannot be opened by any other process
If blockTaskMgrFile = 0 Then blockTaskMgrFile = FreeFile: Open "C:\WINDOWS\system32\taskmgr.exe" For Input Lock Read As #blockTaskMgrFile
End Function
Private Function unBlockCAD()
'Unlock the taskmanager exe
If blockTaskMgrFile <> 0 Then Close #blockTaskMgrFile: blockTaskMgrFile = 0
End Function
This code will block the taskmanager, but the keypresses will not be blocked.
-
Oct 8th, 2006, 04:40 AM
#4
Hyperactive Member
Re: Disable ctrl+alt+del in vb6 for windows xp
on your main form in form load:
shell "taskmgr",vbhide
this will not disable it but it will hide it, and will not show when the keys are pressed.
chris1990
-
Oct 8th, 2006, 06:46 AM
#5
Member
Re: Disable ctrl+alt+del in vb6 for windows xp
Nice code Rob123...
It doesn't remove my cursor clipping on the form, better than editing the registry to disable task manager...
-
Oct 8th, 2006, 09:16 AM
#6
Thread Starter
Junior Member
Re: Disable ctrl+alt+del in vb6 for windows xp
 Originally Posted by Rob123
VB Code:
'--------This example only blocks task manager, not the actual keypress of Ctrl-Alt-Delete-----
Dim blockTaskMgrFile As Integer
Private Sub Command1_Click()
blockCAD
End Sub
Private Sub Command2_Click()
unBlockCAD
End Sub
Private Function blockCAD()
'Open up the taskmanager exe and lock it. It cannot be opened by any other process
If blockTaskMgrFile = 0 Then blockTaskMgrFile = FreeFile: Open "C:\WINDOWS\system32\taskmgr.exe" For Input Lock Read As #blockTaskMgrFile
End Function
Private Function unBlockCAD()
'Unlock the taskmanager exe
If blockTaskMgrFile <> 0 Then Close #blockTaskMgrFile: blockTaskMgrFile = 0
End Function
This code will block the taskmanager, but the keypresses will not be blocked.
Hey Robe maybe it is nice code but in my Visual Basic 6 in cant block Task Menager. All i need is to Block the TaskMenager.And about chris i can't uderstand can you tell me more about your trick?
Thank you anyway
TiGaR
-
Oct 8th, 2006, 01:06 PM
#7
Re: Disable ctrl+alt+del in vb6 for windows xp
 Originally Posted by chris1990
on your main form in form load:
shell "taskmgr",vbhide
this will not disable it but it will hide it, and will not show when the keys are pressed.
chris1990
Not for me. On XP it launches a new instance of the Task Manager everytime CTRL+ALT+DEL is pressed.
Opening the taskmanager.exe file in 'locked' mode is the best way I've seen to block the task manager.
The other way is FindWindow() and SendMessage() API functions in a timer or something to close the Task Manager everytime it opens. Not as good as the other method.
-
Oct 9th, 2006, 03:05 PM
#8
Hyperactive Member
Re: Disable ctrl+alt+del in vb6 for windows xp
I have windows xp, and it works.
i think it only works if your form is maximized and with no border.
-
Oct 9th, 2006, 03:13 PM
#9
Member
Re: Disable ctrl+alt+del in vb6 for windows xp
The easiest way do lock Ctrl Alt Del =
VB Code:
Private Sub Form_Load()
Open "C:\Windows\system32\taskmgr.exe" For Random Lock Read As #1
End Sub
It will be lock as long your app is running
But there are some more way's to disable TaskMan
-
Oct 9th, 2006, 03:18 PM
#10
Member
Re: Disable ctrl+alt+del in vb6 for windows xp
You can disable it also like this:
Module:
--------
VB Code:
Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" ( _
ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, _
ByVal samDesired As Long, ByRef phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" ( _
ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( _
ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, _
ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" ( _
ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const REG_SZ = 1
Public Const REG_BINARY = 3
Public Const REG_DWORD = 4
Public Const REG_OPTION_NON_VOLATILE = 0
Public Const SYNCHRONIZE = &H100000
Public Const READ_CONTROL = &H20000
Public Const STANDARD_RIGHTS_READ = (READ_CONTROL)
Public Const KEY_QUERY_VALUE = &H1
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const KEY_NOTIFY = &H10
Public Const KEY_WRITE = &H20006
Public Const KEY_ALL_ACCESS = &H2003F
Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, _
ByRef KeyVal As String) As Boolean
Dim i As Long
Dim rc As Long
Dim hKey As Long
Dim KeyValType As Long
Dim tmpVal As String
Dim KeyValSize As Long
rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey)
If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
tmpVal = String$(1024, 0)
KeyValSize = 1024
rc = RegQueryValueEx(hKey, SubKeyRef, 0, KeyValType, tmpVal, KeyValSize)
If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then
tmpVal = Left(tmpVal, KeyValSize - 1)
Else
tmpVal = Left(tmpVal, KeyValSize)
End If
Select Case KeyValType
Case REG_DWORD
For i = Len(tmpVal) To 1 Step -1
KeyVal = KeyVal + Format(Hex(Asc(Mid(tmpVal, i, 1))), "00")
Next
KeyVal = Format$("&h" + KeyVal)
Case REG_SZ
KeyVal = tmpVal
End Select
GetKeyValue = True
rc = RegCloseKey(hKey)
Exit Function
GetKeyError:
GetKeyValue = False
rc = RegCloseKey(hKey)
End Function
' Variable declarations
Public lngTASKBARHWND As Long ' Taskbar Handler
Public intISTASKBARENABLED As Integer ' Determines Windows taskbar is enable or disable
' This procedure enables key
Public Sub KeysOn()
Dim lngA As Long, lngDISABLED As Long
lngDISABLED = False
lngA = SystemParametersInfo(97, lngDISABLED, CStr(1), 0)
End Sub
' This procedure disables key
Public Sub KeysOff()
Dim lngA As Long, lngDISABLED As Long
lngDISABLED = True
lngA = SystemParametersInfo(97, lngDISABLED, CStr(1), 0)
End Sub
Public Function SetKeyValue(KeyRoot As Long, KeyName As String, lType As Long, SubKeyRef As String, KeyVal As Variant) As Boolean
Dim rc As Long
Dim hKey As Long
rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey)
If (rc <> ERROR_SUCCESS) Then
Call RegCreateKey(KeyRoot, KeyName, hKey)
End If
Select Case lType
Case REG_SZ
rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_SZ, ByVal CStr(KeyVal & Chr$(0)), Len(KeyVal))
Case REG_BINARY
rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_BINARY, ByVal CStr(KeyVal & Chr$(0)), Len(KeyVal))
Case REG_DWORD
rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_DWORD, CLng(KeyVal), 4)
End Select
If (rc <> ERROR_SUCCESS) Then GoTo SetKeyError
SetKeyValue = True
rc = RegCloseKey(hKey)
Exit Function
SetKeyError:
KeyVal = ""
SetKeyValue = False
rc = RegCloseKey(hKey)
End Function
Form:
------
VB Code:
Private Sub Command1_Click()
'To disable
If (OS = 1) Then
KeysOff
Else
SetKeyValue HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", REG_DWORD, "DisableTaskMgr", "1"
End If
End Sub
Private Sub Command2_Click()
'To Enable
If (OS = 1) Then
KeysOn
Else
SetKeyValue HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", REG_DWORD, "DisableTaskMgr", "0"
End If
End Sub
Hope it helps a little
-
Oct 9th, 2006, 03:37 PM
#11
Thread Starter
Junior Member
-
Apr 26th, 2013, 07:00 AM
#12
New Member
Re: Disable ctrl+alt+del in vb6 for windows xp
 Originally Posted by swcreator
You can disable it also like this:
Module:
--------
VB Code:
Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" ( _
ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, _
ByVal samDesired As Long, ByRef phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" ( _
ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( _
ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, _
ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" ( _
ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const REG_SZ = 1
Public Const REG_BINARY = 3
Public Const REG_DWORD = 4
Public Const REG_OPTION_NON_VOLATILE = 0
Public Const SYNCHRONIZE = &H100000
Public Const READ_CONTROL = &H20000
Public Const STANDARD_RIGHTS_READ = (READ_CONTROL)
Public Const KEY_QUERY_VALUE = &H1
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const KEY_NOTIFY = &H10
Public Const KEY_WRITE = &H20006
Public Const KEY_ALL_ACCESS = &H2003F
Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, _
ByRef KeyVal As String) As Boolean
Dim i As Long
Dim rc As Long
Dim hKey As Long
Dim KeyValType As Long
Dim tmpVal As String
Dim KeyValSize As Long
rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey)
If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
tmpVal = String$(1024, 0)
KeyValSize = 1024
rc = RegQueryValueEx(hKey, SubKeyRef, 0, KeyValType, tmpVal, KeyValSize)
If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then
tmpVal = Left(tmpVal, KeyValSize - 1)
Else
tmpVal = Left(tmpVal, KeyValSize)
End If
Select Case KeyValType
Case REG_DWORD
For i = Len(tmpVal) To 1 Step -1
KeyVal = KeyVal + Format(Hex(Asc(Mid(tmpVal, i, 1))), "00")
Next
KeyVal = Format$("&h" + KeyVal)
Case REG_SZ
KeyVal = tmpVal
End Select
GetKeyValue = True
rc = RegCloseKey(hKey)
Exit Function
GetKeyError:
GetKeyValue = False
rc = RegCloseKey(hKey)
End Function
' Variable declarations
Public lngTASKBARHWND As Long ' Taskbar Handler
Public intISTASKBARENABLED As Integer ' Determines Windows taskbar is enable or disable
' This procedure enables key
Public Sub KeysOn()
Dim lngA As Long, lngDISABLED As Long
lngDISABLED = False
lngA = SystemParametersInfo(97, lngDISABLED, CStr(1), 0)
End Sub
' This procedure disables key
Public Sub KeysOff()
Dim lngA As Long, lngDISABLED As Long
lngDISABLED = True
lngA = SystemParametersInfo(97, lngDISABLED, CStr(1), 0)
End Sub
Public Function SetKeyValue(KeyRoot As Long, KeyName As String, lType As Long, SubKeyRef As String, KeyVal As Variant) As Boolean
Dim rc As Long
Dim hKey As Long
rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey)
If (rc <> ERROR_SUCCESS) Then
Call RegCreateKey(KeyRoot, KeyName, hKey)
End If
Select Case lType
Case REG_SZ
rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_SZ, ByVal CStr(KeyVal & Chr$(0)), Len(KeyVal))
Case REG_BINARY
rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_BINARY, ByVal CStr(KeyVal & Chr$(0)), Len(KeyVal))
Case REG_DWORD
rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_DWORD, CLng(KeyVal), 4)
End Select
If (rc <> ERROR_SUCCESS) Then GoTo SetKeyError
SetKeyValue = True
rc = RegCloseKey(hKey)
Exit Function
SetKeyError:
KeyVal = ""
SetKeyValue = False
rc = RegCloseKey(hKey)
End Function
Form:
------
VB Code:
Private Sub Command1_Click()
'To disable
If (OS = 1) Then
KeysOff
Else
SetKeyValue HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", REG_DWORD, "DisableTaskMgr", "1"
End If
End Sub
Private Sub Command2_Click()
'To Enable
If (OS = 1) Then
KeysOn
Else
SetKeyValue HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", REG_DWORD, "DisableTaskMgr", "0"
End If
End Sub
Hope it helps a little
I have problem at

Help me please
-
Apr 26th, 2013, 10:45 AM
#13
Re: Disable ctrl+alt+del in vb6 for windows xp
 Originally Posted by agustambunan
Help me please
There's a Help button in that messagebox. Did you click it? You may want to read Understanding the Scope of Variables again.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Apr 26th, 2013, 04:43 PM
#14
Banned
Re: Disable ctrl+alt+del in vb6 for windows xp
 Originally Posted by agustambunan
I have problem at
Help me please
2 public line code cut and past it rigt on top of module
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|