Tools Links Login

How To Write To a INI File

This VERY Simple 5 Line Code Writes To a INI File! Enjoy!

Original Author: Randy Porosky

Assumptions

Place a Command Button on The Form, Name it Command1. Put The 1 Declaration in a Module. Have Fun!

API Declarations

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

Code

Public Sub iniWrite(sFileName As String, sKey As String, sSection As String, ByVal sValue As String)
Dim iW As String
iW = WritePrivateProfileString(sSection, sKey, sValue, sFileName)
End Sub
Private Sub Command1_Click()
iniWrite "C:WindowsDesktopFile.ini", "Neat", "Pretty", "Huh?"
End Sub
'Have Fun!

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 82 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.