VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



If you wanna write and read your program settings from Win.ini this code is for you...

by Jafo C - Null (3 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 1st April 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

If you wanna write and read your program settings from Win.ini this code is for you...

API Declarations



Declare Function WriteProfileString Lib "kernel32" Alias "WriteProfileStringA" (ByVal lpszSection As String, ByVal lpszKeyName As String, ByVal lpszString As String) As Long

Rate If you wanna write and read your program settings from Win.ini this code is for you...



'FUNCTION: GetWinProfile

Function GetWinProfile(ByVal AppName As String, ByVal strKey As String, ByVal intFMode As Integer) As Variant
    Dim strBuffer As String
    Dim intPos As Integer

    strBuffer = Space$(gintMAX_SIZE)
    
    If GetProfileString(AppName, strKey, gstrNULL, strBuffer, gintMAX_SIZE) > 0 Then
        If intFMode = 1 Then
        GetWinProfile = Int(Val(RTrim$(StripTerminator(strBuffer))))
        Else
        GetWinProfile = RTrim$(StripTerminator(strBuffer))
        End If
    Else
        If intFMode = 0 Then
            GetWinProfile = gstrNULL
        Else
            GetWinProfile = 0
        End If
    End If
End Function

------
'Function WriteWinProfile
------
Function WriteWinProfile(ByVal AppName As String, ByVal strKey As String, ByRef VrValue As Variant) As Long
    WriteWinProfile = WriteProfileString(AppName, strKey, VrValue)
End Function
'-----------------------

Download this snippet    Add to My Saved Code

If you wanna write and read your program settings from Win.ini this code is for you... Comments

No comments have been posted about If you wanna write and read your program settings from Win.ini this code is for you.... Why not be the first to post a comment about If you wanna write and read your program settings from Win.ini this code is for you....

Post your comment

Subject:
Message:
0/1000 characters