Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
XML RSS Feed
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleRead and write INI files
KeywordsINI file, initialization file, registry
CategoriesTips and Tricks
 
Use the GetPrivateProfileString, GetPrivateProfileInt, and WritePrivateProfileString SPI functions.
 
' Get the value.
Private Sub cmdGet_Click()
Dim buf As String * 256
Dim length As Long

    length = GetPrivateProfileString( _
        txtApplication.Text, txtKey.Text, "<no value>", _
        buf, Len(buf), txtFilename.Text)
    txtValue.Text = Left$(buf, length)
End Sub

' Set the value.
Private Sub cmdSet_Click()
    WritePrivateProfileString _
        txtApplication.Text, txtKey.Text, _
        txtValue.Text, txtFilename.Text
    txtValue.Text = "Ok"
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated