Results 1 to 14 of 14

Thread: Disable ctrl+alt+del in vb6 for windows xp

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Location
    Europa-->Macedonia-->Prilep
    Posts
    26

    Thumbs up Disable ctrl+alt+del in vb6 for windows xp

    OK!
    Guys i need to block ctrl+alt+del for my new project.I know that trick with screensaver but it only works with windows 9x.
    That API function makes computer to think that screensaver is running and in windows 9x when screensaver is running ctrl+alt+del is disable.
    But i am using windows xp and i need some trick to disable ctrl+alt+del so guys i was trying to download some code from other forums and from other researchers but those dont work. i hope that you guys will help me to find real code to break ctrl+alt+del first and if it is possbile to block alt+tab and ctrl+exc.I am waiting your help guys.

  2. #2

  3. #3
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Melbourne, Australia
    Posts
    415

    Re: Disable ctrl+alt+del in vb6 for windows xp

    VB Code:
    1. '--------This example only blocks task manager, not the actual keypress of Ctrl-Alt-Delete-----
    2. Dim blockTaskMgrFile As Integer
    3.  
    4. Private Sub Command1_Click()
    5. blockCAD
    6. End Sub
    7.  
    8. Private Sub Command2_Click()
    9. unBlockCAD
    10. End Sub
    11.  
    12. Private Function blockCAD()
    13.     'Open up the taskmanager exe and lock it. It cannot be opened by any other process
    14.     If blockTaskMgrFile = 0 Then blockTaskMgrFile = FreeFile: Open "C:\WINDOWS\system32\taskmgr.exe" For Input Lock Read As #blockTaskMgrFile
    15. End Function
    16.  
    17. Private Function unBlockCAD()
    18.     'Unlock the taskmanager exe
    19.     If blockTaskMgrFile <> 0 Then Close #blockTaskMgrFile: blockTaskMgrFile = 0
    20. End Function
    This code will block the taskmanager, but the keypresses will not be blocked.

  4. #4
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    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

  5. #5
    Member
    Join Date
    Jul 2006
    Posts
    53

    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...

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Location
    Europa-->Macedonia-->Prilep
    Posts
    26

    Question Re: Disable ctrl+alt+del in vb6 for windows xp

    Quote Originally Posted by Rob123
    VB Code:
    1. '--------This example only blocks task manager, not the actual keypress of Ctrl-Alt-Delete-----
    2. Dim blockTaskMgrFile As Integer
    3.  
    4. Private Sub Command1_Click()
    5. blockCAD
    6. End Sub
    7.  
    8. Private Sub Command2_Click()
    9. unBlockCAD
    10. End Sub
    11.  
    12. Private Function blockCAD()
    13.     'Open up the taskmanager exe and lock it. It cannot be opened by any other process
    14.     If blockTaskMgrFile = 0 Then blockTaskMgrFile = FreeFile: Open "C:\WINDOWS\system32\taskmgr.exe" For Input Lock Read As #blockTaskMgrFile
    15. End Function
    16.  
    17. Private Function unBlockCAD()
    18.     'Unlock the taskmanager exe
    19.     If blockTaskMgrFile <> 0 Then Close #blockTaskMgrFile: blockTaskMgrFile = 0
    20. 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

  7. #7
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Disable ctrl+alt+del in vb6 for windows xp

    Quote 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.

  8. #8
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    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.

  9. #9
    Member
    Join Date
    Sep 2006
    Posts
    41

    Re: Disable ctrl+alt+del in vb6 for windows xp

    The easiest way do lock Ctrl Alt Del =
    VB Code:
    1. Private Sub Form_Load()
    2. Open "C:\Windows\system32\taskmgr.exe" For Random Lock Read As #1
    3. End Sub
    It will be lock as long your app is running

    But there are some more way's to disable TaskMan

  10. #10
    Member
    Join Date
    Sep 2006
    Posts
    41

    Re: Disable ctrl+alt+del in vb6 for windows xp

    You can disable it also like this:

    Module:
    --------
    VB Code:
    1. Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" ( _
    2.     ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, _
    3.     ByVal samDesired As Long, ByRef phkResult As Long) As Long
    4.  
    5.  
    6. Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" ( _
    7.     ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
    8.     ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long
    9.  
    10.  
    11. Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
    12.  
    13.  
    14. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( _
    15.     ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, _
    16.     ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
    17.  
    18.  
    19. Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" ( _
    20.     ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    21.  
    22.  
    23.  
    24. Public Const HKEY_CLASSES_ROOT = &H80000000
    25. Public Const HKEY_CURRENT_USER = &H80000001
    26. Public Const HKEY_LOCAL_MACHINE = &H80000002
    27. Public Const REG_SZ = 1
    28. Public Const REG_BINARY = 3
    29. Public Const REG_DWORD = 4
    30. Public Const REG_OPTION_NON_VOLATILE = 0
    31. Public Const SYNCHRONIZE = &H100000
    32. Public Const READ_CONTROL = &H20000
    33. Public Const STANDARD_RIGHTS_READ = (READ_CONTROL)
    34. Public Const KEY_QUERY_VALUE = &H1
    35. Public Const KEY_ENUMERATE_SUB_KEYS = &H8
    36. Public Const KEY_NOTIFY = &H10
    37. Public Const KEY_WRITE = &H20006
    38. Public Const KEY_ALL_ACCESS = &H2003F
    39.  
    40.  
    41. Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, _
    42.     ByRef KeyVal As String) As Boolean
    43.     Dim i As Long
    44.     Dim rc As Long
    45.     Dim hKey As Long
    46.     Dim KeyValType As Long
    47.     Dim tmpVal As String
    48.     Dim KeyValSize As Long
    49.    
    50.     rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey)
    51.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
    52.    
    53.     tmpVal = String$(1024, 0)
    54.     KeyValSize = 1024
    55.    
    56.     rc = RegQueryValueEx(hKey, SubKeyRef, 0, KeyValType, tmpVal, KeyValSize)
    57.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
    58.    
    59.  
    60.  
    61.     If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then
    62.         tmpVal = Left(tmpVal, KeyValSize - 1)
    63.     Else
    64.         tmpVal = Left(tmpVal, KeyValSize)
    65.     End If
    66.    
    67.  
    68.  
    69.     Select Case KeyValType
    70.         Case REG_DWORD
    71.  
    72.  
    73.         For i = Len(tmpVal) To 1 Step -1
    74.             KeyVal = KeyVal + Format(Hex(Asc(Mid(tmpVal, i, 1))), "00")
    75.         Next
    76.         KeyVal = Format$("&h" + KeyVal)
    77.         Case REG_SZ
    78.         KeyVal = tmpVal
    79.     End Select
    80.  
    81. GetKeyValue = True
    82. rc = RegCloseKey(hKey)
    83. Exit Function
    84.  
    85. GetKeyError:
    86. GetKeyValue = False
    87. rc = RegCloseKey(hKey)
    88. End Function
    89.  
    90.  
    91.  
    92. ' Variable declarations
    93. Public lngTASKBARHWND As Long ' Taskbar Handler
    94. Public intISTASKBARENABLED As Integer ' Determines Windows taskbar is enable or disable
    95.  
    96. ' This procedure enables key
    97. Public Sub KeysOn()
    98. Dim lngA As Long, lngDISABLED As Long
    99.  
    100. lngDISABLED = False
    101. lngA = SystemParametersInfo(97, lngDISABLED, CStr(1), 0)
    102. End Sub
    103.  
    104. ' This procedure disables key
    105. Public Sub KeysOff()
    106. Dim lngA As Long, lngDISABLED As Long
    107.  
    108. lngDISABLED = True
    109. lngA = SystemParametersInfo(97, lngDISABLED, CStr(1), 0)
    110. End Sub
    111.  
    112.  
    113. Public Function SetKeyValue(KeyRoot As Long, KeyName As String, lType As Long, SubKeyRef As String, KeyVal As Variant) As Boolean
    114.     Dim rc As Long
    115.     Dim hKey As Long
    116.    
    117.     rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey)
    118.    
    119.     If (rc <> ERROR_SUCCESS) Then
    120.         Call RegCreateKey(KeyRoot, KeyName, hKey)
    121.     End If
    122.  
    123.     Select Case lType
    124.         Case REG_SZ
    125.         rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_SZ, ByVal CStr(KeyVal & Chr$(0)), Len(KeyVal))
    126.         Case REG_BINARY
    127.         rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_BINARY, ByVal CStr(KeyVal & Chr$(0)), Len(KeyVal))
    128.         Case REG_DWORD
    129.         rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_DWORD, CLng(KeyVal), 4)
    130.     End Select
    131. If (rc <> ERROR_SUCCESS) Then GoTo SetKeyError
    132.  
    133. SetKeyValue = True
    134. rc = RegCloseKey(hKey)
    135.  
    136. Exit Function
    137. SetKeyError:
    138. KeyVal = ""
    139. SetKeyValue = False
    140. rc = RegCloseKey(hKey)
    141. End Function

    Form:
    ------
    VB Code:
    1. Private Sub Command1_Click()
    2. 'To disable
    3. If (OS = 1) Then
    4.     KeysOff
    5. Else
    6.     SetKeyValue HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", REG_DWORD, "DisableTaskMgr", "1"
    7. End If
    8. End Sub
    9.  
    10. Private Sub Command2_Click()
    11. 'To Enable
    12. If (OS = 1) Then
    13.     KeysOn
    14. Else
    15.     SetKeyValue HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", REG_DWORD, "DisableTaskMgr", "0"
    16. End If
    End Sub

    Hope it helps a little

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Location
    Europa-->Macedonia-->Prilep
    Posts
    26

    Wink Re: Disable ctrl+alt+del in vb6 for windows xp

    OK,
    Hi Guys,
    Thank You Very Much Finally i solve this problem with help from you guys....I dont know what to write now.....we solve this problem and i mean that this Thread is Solved

    Thank You again
    Thank You very much again

    GoodLuck
    TiGaR

  12. #12
    New Member
    Join Date
    Apr 2013
    Posts
    1

    Re: Disable ctrl+alt+del in vb6 for windows xp

    Quote Originally Posted by swcreator View Post
    You can disable it also like this:

    Module:
    --------
    VB Code:
    1. Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" ( _
    2.     ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, _
    3.     ByVal samDesired As Long, ByRef phkResult As Long) As Long
    4.  
    5.  
    6. Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" ( _
    7.     ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
    8.     ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long
    9.  
    10.  
    11. Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
    12.  
    13.  
    14. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( _
    15.     ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, _
    16.     ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
    17.  
    18.  
    19. Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" ( _
    20.     ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    21.  
    22.  
    23.  
    24. Public Const HKEY_CLASSES_ROOT = &H80000000
    25. Public Const HKEY_CURRENT_USER = &H80000001
    26. Public Const HKEY_LOCAL_MACHINE = &H80000002
    27. Public Const REG_SZ = 1
    28. Public Const REG_BINARY = 3
    29. Public Const REG_DWORD = 4
    30. Public Const REG_OPTION_NON_VOLATILE = 0
    31. Public Const SYNCHRONIZE = &H100000
    32. Public Const READ_CONTROL = &H20000
    33. Public Const STANDARD_RIGHTS_READ = (READ_CONTROL)
    34. Public Const KEY_QUERY_VALUE = &H1
    35. Public Const KEY_ENUMERATE_SUB_KEYS = &H8
    36. Public Const KEY_NOTIFY = &H10
    37. Public Const KEY_WRITE = &H20006
    38. Public Const KEY_ALL_ACCESS = &H2003F
    39.  
    40.  
    41. Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, _
    42.     ByRef KeyVal As String) As Boolean
    43.     Dim i As Long
    44.     Dim rc As Long
    45.     Dim hKey As Long
    46.     Dim KeyValType As Long
    47.     Dim tmpVal As String
    48.     Dim KeyValSize As Long
    49.    
    50.     rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey)
    51.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
    52.    
    53.     tmpVal = String$(1024, 0)
    54.     KeyValSize = 1024
    55.    
    56.     rc = RegQueryValueEx(hKey, SubKeyRef, 0, KeyValType, tmpVal, KeyValSize)
    57.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
    58.    
    59.  
    60.  
    61.     If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then
    62.         tmpVal = Left(tmpVal, KeyValSize - 1)
    63.     Else
    64.         tmpVal = Left(tmpVal, KeyValSize)
    65.     End If
    66.    
    67.  
    68.  
    69.     Select Case KeyValType
    70.         Case REG_DWORD
    71.  
    72.  
    73.         For i = Len(tmpVal) To 1 Step -1
    74.             KeyVal = KeyVal + Format(Hex(Asc(Mid(tmpVal, i, 1))), "00")
    75.         Next
    76.         KeyVal = Format$("&h" + KeyVal)
    77.         Case REG_SZ
    78.         KeyVal = tmpVal
    79.     End Select
    80.  
    81. GetKeyValue = True
    82. rc = RegCloseKey(hKey)
    83. Exit Function
    84.  
    85. GetKeyError:
    86. GetKeyValue = False
    87. rc = RegCloseKey(hKey)
    88. End Function
    89.  
    90.  
    91.  
    92. ' Variable declarations
    93. Public lngTASKBARHWND As Long ' Taskbar Handler
    94. Public intISTASKBARENABLED As Integer ' Determines Windows taskbar is enable or disable
    95.  
    96. ' This procedure enables key
    97. Public Sub KeysOn()
    98. Dim lngA As Long, lngDISABLED As Long
    99.  
    100. lngDISABLED = False
    101. lngA = SystemParametersInfo(97, lngDISABLED, CStr(1), 0)
    102. End Sub
    103.  
    104. ' This procedure disables key
    105. Public Sub KeysOff()
    106. Dim lngA As Long, lngDISABLED As Long
    107.  
    108. lngDISABLED = True
    109. lngA = SystemParametersInfo(97, lngDISABLED, CStr(1), 0)
    110. End Sub
    111.  
    112.  
    113. Public Function SetKeyValue(KeyRoot As Long, KeyName As String, lType As Long, SubKeyRef As String, KeyVal As Variant) As Boolean
    114.     Dim rc As Long
    115.     Dim hKey As Long
    116.    
    117.     rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey)
    118.    
    119.     If (rc <> ERROR_SUCCESS) Then
    120.         Call RegCreateKey(KeyRoot, KeyName, hKey)
    121.     End If
    122.  
    123.     Select Case lType
    124.         Case REG_SZ
    125.         rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_SZ, ByVal CStr(KeyVal & Chr$(0)), Len(KeyVal))
    126.         Case REG_BINARY
    127.         rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_BINARY, ByVal CStr(KeyVal & Chr$(0)), Len(KeyVal))
    128.         Case REG_DWORD
    129.         rc = RegSetValueEx(hKey, SubKeyRef, 0&, REG_DWORD, CLng(KeyVal), 4)
    130.     End Select
    131. If (rc <> ERROR_SUCCESS) Then GoTo SetKeyError
    132.  
    133. SetKeyValue = True
    134. rc = RegCloseKey(hKey)
    135.  
    136. Exit Function
    137. SetKeyError:
    138. KeyVal = ""
    139. SetKeyValue = False
    140. rc = RegCloseKey(hKey)
    141. End Function

    Form:
    ------
    VB Code:
    1. Private Sub Command1_Click()
    2. 'To disable
    3. If (OS = 1) Then
    4.     KeysOff
    5. Else
    6.     SetKeyValue HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", REG_DWORD, "DisableTaskMgr", "1"
    7. End If
    8. End Sub
    9.  
    10. Private Sub Command2_Click()
    11. 'To Enable
    12. If (OS = 1) Then
    13.     KeysOn
    14. Else
    15.     SetKeyValue HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", REG_DWORD, "DisableTaskMgr", "0"
    16. End If
    End Sub

    Hope it helps a little

    I have problem at

    Name:  480360_621975131163742_1607441760_n.jpg
Views: 1070
Size:  91.5 KB


    Help me please

  13. #13
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Disable ctrl+alt+del in vb6 for windows xp

    Quote Originally Posted by agustambunan View Post
    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)

  14. #14
    Banned
    Join Date
    Nov 2012
    Posts
    1,171

    Re: Disable ctrl+alt+del in vb6 for windows xp

    Quote Originally Posted by agustambunan View Post
    I have problem at

    Name:  480360_621975131163742_1607441760_n.jpg
Views: 1070
Size:  91.5 KB


    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
  •  



Click Here to Expand Forum to Full Width