VB 24/7  

Go Back   VB 24/7 > Visual Basic > Visual Basic 6

Reply
 
Thread Tools Display Modes
  #1  
Old 07-07-2008, 12:47 PM
Jason221 Jason221 is offline
Junior Member
 
Join Date: Jul 2008
Posts: 1
Post Read and Write Values to the registry

Hello,

I am wondering if there is an easy way to read/write values to windows registry?

Thanks in advance..
Reply With Quote
  #2  
Old 07-08-2008, 02:44 PM
Sam Sam is offline
Junior Member
 
Join Date: Jul 2008
Posts: 2
Default

You will need to refrence to Windows API to be able to access the registry within VB6


Private Declare Function RegCreateKeyEx _
                Lib "advapi32.dll" _
                Alias "RegCreateKeyExA" (ByVal hKey As Long, _
                                         ByVal lpSubKey As String, _
                                         ByVal Reserved As Long, _
                                         ByVal lpClass As String, _
                                         ByVal dwOptions As Long, _
                                         ByVal samDesired As Long, _
                                         lpSecurityAttributes As Any, _
                                         phkResult As Long, _
                                         lpdwDisposition As Long) As Long
 
Private Declare Function RegOpenKeyEx _
                Lib "advapi32" _
                Alias "RegOpenKeyExA" (ByVal hKey As Long, _
                                       ByVal lpSubKey As String, _
                                       ByVal ulOptions As Long, _
                                       ByVal samDesired As Long, _
                                       ByRef phkResult As Long) As Long
 
Private Declare Function RegQueryValueEx _
                Lib "advapi32" _
                Alias "RegQueryValueExA" (ByVal hKey As Long, _
                                          ByVal lpValueName As String, _
                                          ByVal lpReserved As Long, _
                                          ByRef lpType As Long, _
                                          ByVal lpData As String, _
                                          ByRef lpcbData As Long) As Long
 
Private Declare Function RegCloseKey _
                Lib "advapi32" (ByVal hKey As Long) As Long
 
Private Declare Function GetVolumeInformation _
                Lib "kernel32.dll" _
                Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, _
                                               ByVal lpVolumeNameBuffer As String, _
                                               ByVal nVolumeNameSize As Integer, _
                                               lpVolumeSerialNumber As Long, _
                                               lpMaximumComponentLength As Long, _
                                               lpFileSystemFlags As Long, _
                                               ByVal lpFileSystemNameBuffer As String, _
                                               ByVal nFileSystemNameSize 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         ' Note that if you declar
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump


All times are GMT. The time now is 12:29 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.