Hi i waned to edit one of the value that is found in the registry, but don't know how:S, can someone show me a sample code, for example HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes
thanks
Printable View
Hi i waned to edit one of the value that is found in the registry, but don't know how:S, can someone show me a sample code, for example HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes
thanks
Search the forums for RegOpenKey and RegSetValueEx and you will find many code examples. :)
Well, i've tried this code and it don't seems working
vb Code:
Option Explicit 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 RegDeleteValue Lib "advapi32.dll" Alias "" () 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 Const REG_SZ = 1 Private Const HKEY_LOCAL_MACHINE = &H80000001 Private Sub SaveString(HKey As Long, Path As String, Name As String, Data As String) Dim KeyHandle As Long Dim RetVal As Long RetVal = RegCreateKey(HKey, Path, KeyHandle) RetVal = RegSetValueEx(KeyHandle, Name, 0, REG_SZ, ByVal Data, Len(Data)) RetVal = RegCloseKey(KeyHandle) End Sub Private Sub MSShellDlg(text As String) Call SaveString(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes", "MS Shell Dlg", text) MsgBox "done1" End Sub Private Sub Command1_Click() MSShellDlg ("Tahoma") MsgBox "done" End Sub
Since you now want to create the actual key then do you also have proper permissions and have you tried refreshing the registry?
Yes i have the admin permission , and i tried refreshing but it's still the same.
Thanks
well i found the problem, i changedtovb Code:
Private Const HKEY_LOCAL_MACHINE = &H80000001and it's working perfectvb Code:
Private Const HKEY_LOCAL_MACHINE = &H80000002