Jag vill ändra i system registret med mitt vb program och får inte det att fungera nån som har nån ide varför: <code>System register.
Option Explicit
Function fWriteValue(ByVal sTopKeyOrFile As String, _
ByVal sSubKeyOrSection As String, ByVal sValueName As String, _
ByVal sValueType As String, ByVal vValue As Variant) As Long
End Function
Private Sub Command1_Click()
Call fWriteValue("HKCU", "Software\Microsoft\Internet Explorer\Main", "Window Title", "S", "IExplorare")
End SubSv: System register.
Option Explicit
Private Const REG_SZ As Long = 1&
Private Const HKEY_CURRENT_USER As Long = &H80000001
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey 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
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
Sub SaveString(hKey As Long, strPath As String, strValue As String, strData As String)
Dim Ret As Long
'Create/Open a key
RegCreateKey hKey, strPath, Ret
'Save a string to the key
RegSetValueEx Ret, strValue, 0, REG_SZ, ByVal strData, Len(strData)
'close the key
RegCloseKey Ret
End Sub
Private Sub Command1_Click()
SaveString HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main", "Window Title", " - muu -"
End Sub
</code>