|
-
Aug 26th, 2007, 08:16 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Edit Registry
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
-
Aug 26th, 2007, 10:04 AM
#2
Re: Edit Registry
Search the forums for RegOpenKey and RegSetValueEx and you will find many code examples.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 26th, 2007, 10:47 AM
#3
Thread Starter
Frenzied Member
Re: Edit Registry
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
-
Aug 26th, 2007, 10:50 AM
#4
Re: Edit Registry
Since you now want to create the actual key then do you also have proper permissions and have you tried refreshing the registry?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 26th, 2007, 10:58 AM
#5
Thread Starter
Frenzied Member
Re: Edit Registry
Yes i have the admin permission , and i tried refreshing but it's still the same.
Thanks
-
Aug 26th, 2007, 11:09 AM
#6
Thread Starter
Frenzied Member
Re: Edit Registry
well i found the problem, i changed
vb Code:
Private Const HKEY_LOCAL_MACHINE = &H80000001
to
vb Code:
Private Const HKEY_LOCAL_MACHINE = &H80000002
and it's working perfect
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|