在HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer下建一个名为NoClose的down型的项,值为1即可。可别干坏事啊!  :)

解决方案 »

  1.   

    如下:
    Option Explicit
    Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
    Private Declare Function RegCloseKey Lib "advapi32.dll" (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 Long, ByVal cbData As Long) As Long
    Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As LongPrivate Const REG_DWORD As Long = 4
    Private Const KEY_ALL_ACCESS = &H3F
    Private Const HKEY_USERS = &H80000003
    Sub ResumeClose()   '恢复关闭系统
    Dim i As Long, hKey As Long
    i = RegOpenKeyEx(HKEY_USERS, ".DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", 0, KEY_ALL_ACCESS, hKey)
    i = RegDeleteValue(hKey, "NoClose")
    i = RegCloseKey(hKey)
    End SubSub NoClose()    '禁止关闭系统
    Dim i As Long, hKey As Longi = RegOpenKeyEx(HKEY_USERS, ".DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", 0, KEY_ALL_ACCESS, hKey)
    i = RegSetValueEx(hKey, "NoClose", 0, REG_DWORD, 1, 4)
    i = RegCloseKey(hKey)
    End SubAPI的声明我做过修改,请一起复制去。
    要注销一次,才能有效。
      

  2.   

    如下:
    Option Explicit
    Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
    Private Declare Function RegCloseKey Lib "advapi32.dll" (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 Long, ByVal cbData As Long) As Long
    Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As LongPrivate Const REG_DWORD As Long = 4
    Private Const KEY_ALL_ACCESS = &H3F
    Private Const HKEY_USERS = &H80000003
    Sub ResumeClose()   '恢复关闭系统
    Dim i As Long, hKey As Long
    i = RegOpenKeyEx(HKEY_USERS, ".DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", 0, KEY_ALL_ACCESS, hKey)
    i = RegDeleteValue(hKey, "NoClose")
    i = RegCloseKey(hKey)
    End SubSub NoClose()    '禁止关闭系统
    Dim i As Long, hKey As Longi = RegOpenKeyEx(HKEY_USERS, ".DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", 0, KEY_ALL_ACCESS, hKey)
    i = RegSetValueEx(hKey, "NoClose", 0, REG_DWORD, 1, 4)
    i = RegCloseKey(hKey)
    End SubAPI的声明我做过修改,请一起复制去。
    要注销一次,才能有效。
      

  3.   

    VB操作注册表:
    http://www.sqreg.com/file/vb/reg_01.htm
    http://www.sqreg.com/file/vb/reg_02.htm
    http://www.sqreg.com/file/vb/reg_03.htm
    http://www.sqreg.com/file/vb/reg_04.htm
    http://www.sqreg.com/file/vb/reg_05.htm
    http://www.sqreg.com/file/vb/reg_06.htm
    http://www.sqreg.com/file/vb/reg_07.htm