Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write to registry and ini file

Status
Not open for further replies.

redlair

Technical User
Joined
Jun 29, 2004
Messages
54
Location
US
In two seperate projects I need to change a path in the registry and in an ini file. For the registry I have found multiple methodes to writing to the registry. What is the most direct way to change to path in a key.
 
The following 2 are the easiest for INI files... there are a few others as well depending on what you are trying to do.

Code:
'Win32 API for reading INI file:
Private Declare Function GetPrivateProfileString Lib "kernel32" _
        Alias "GetPrivateProfileStringA" _
        (ByVal lpApplicationName As String, _
        ByVal lpKeyName As Any, _
        ByVal lpDefault As String, _
        ByVal lpReturnedString As String, _
        ByVal nSize As Long, _
        ByVal lpFileName As String) As Long

'Win32 API for writing to INI file:
Private Declare Function WritePrivateProfileString Lib "kernel32" _
        Alias "WritePrivateProfileStringA" _
        (ByVal lpApplicationName As String, _
        ByVal lpKeyName As Any, _
        ByVal lpString As Any, _
        ByVal lpFileName As String) As Long
 
Sheco, Thank you I will give this a try, it is a start. What do you know about the registry write.
 
The VB registry functions probably will not work for you, depending on the entries you need to change. VB's registry functions work only on a small subset of the registry (HKEY_CURRENT_USER\Software\VB and VBA Program Settings\application-name\section-name).

You can call the windows API registry functions, but I've never done that so I can't help with it.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
For saving into registry Have a Search on two keywords

SaveSetting
GetSetting

Regards

Zameer Abdulla
Visit Me
 
The APIs for registry operation all start with REG

Start here:

For INI files start here:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

For tsunami relief donations

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top