NoAutoUpdate problemer
Heza.Jeg har lige en lille kode her:
Imports Microsoft.Win32
Public Class Form1
Private Const Key As Integer = &H2003F
Private Const HKEY_LOCAL_MACHINE As Integer = -2147483647
Private Const Enable As Short = 0
Private Const Disable As Short = 1
Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Integer, ByVal lpSubKey As String, ByVal ulOptions As Integer, ByVal samDesired As Integer, ByRef phkResult As Integer) As Integer
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Integer, ByVal lpValueName As String, ByVal Reserved As Integer, ByVal dwType As Integer, ByRef lpData As Integer, ByVal cbData As Integer) As Integer
Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Integer) As Integer
Public Function SetKey(ByRef Data As Short)
Dim Value, OpenKey, hKey As Integer
OpenKey = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", 0, Key, hKey)
Value = RegSetValueEx(hKey, "NoAutoUpdate", 0, 4, CInt(Data), 4)
Value = RegCloseKey(hKey)
End
End Function
Public Function EnableTask()
'Dim Req
'Req = MessageBox.Show("Do You Want Enable Task Manager?", "Enable Task Manager", MessageBoxButtons.YesNo)
'If Req = vbYes Then
Call SetKey(Enable)
'Else
'End If
End
End Function
Public Function NoAutoUpdate()
'Dim Req
'Req = MessageBox.Show("Do You Want Disable Task Manager?", "Disable Task Manager", MessageBoxButtons.YesNo)
'If Req = vbYes Then
Call SetKey(Disable)
'Else
'End If
End
End Function
End Class
Jeg kan ikke få det helt til at du fordi før var det lavet til at gå under
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System
Nu har jeg så sat den til at skal gå under
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
og det vil den bare ikke skrive noget der inde. Den kommer ikke med nogen fejl overhovet. Er der nogen der kan hjælp med det?
;=)