VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Read INI

by Dan Einarsson (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

Opens a INI-file and Get the value of ex: "Screensaver=" without using any system calls!!!

Inputs
x = ReadINI("screensaver", "c:\windows\system.ini") 'or what ever
Code Returns
the value of the keyname in this ex it would be perhaps: screensav.exe
API Declarations
NONE that is why i posted it!!!

Rate Read INI

Function ReadINI(keyname As String, filename As String) As String
Open filename For Input Access Read As 1
Do Until EOF(1)
  Line Input #1, stemp
    ipos = InStr(stemp, keyname & "=")
    If ipos Then
      strinnick = strinnick + stemp
      ifound = True
      Allofit$ = strinnick
      wow$ = Mid(Allofit$, Len(keyname) + 2)
      GetINI = wow$
      Close 1
      Exit Function
    End If
Loop
  Close 1
End Function
'Written by: Dan Einarsson

Download this snippet    Add to My Saved Code

Read INI Comments

No comments have been posted about Read INI. Why not be the first to post a comment about Read INI.

Post your comment

Subject:
Message:
0/1000 characters