Advertisement
2002C Files/ File Controls/ Input/ Output #8649

16 and 32 bit functions to create

16 AND 32 bit functions to read/write ini files--very useful!

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
Create a new module called: INI_SM.BAS
Add an attribute:
Attribute VB_Name = "ini_sm"
Add this code:
'*******************************************************
'* Procedure Name: sReadINI              *
'*=====================================================*
'*Returns a string from an INI file. To use, call the *
'*functions and pass it the Section, KeyName and INI  *
'*File Name, [sRet=sReadINI(Section,Key1,INIFile)].  *
'*val command.                     *
'*******************************************************
Function ReadINI(Section, KeyName, filename As String) As String
    Dim sRet As String
    sRet = String(255, Chr(0))
    ReadINI = Left(sRet, GetPrivateProfileString(Section, ByVal KeyName, "", sRet, Len(sRet), filename))
End Function
'*******************************************************
'* Procedure Name: WriteINI              *
'*=====================================================*
'*Writes a string to an INI file. To use, call the   *
'*function and pass it the sSection, sKeyName, the New *
'*String and the INI File Name,            *
'*[Ret=WriteINI(Section,Key,String,INIFile)].     *
'*Returns a 1 if there were no errors and       *
'*a 0 if there were errors.              *
'*******************************************************
Function writeini(sSection As String, sKeyName As String, sNewString As String, sFileName) As Integer
    Dim r
    r = WritePrivateProfileString(sSection, sKeyName, sNewString, sFileName)
End Function
Upload
Původní komentáře (3)
Obnoveno z Wayback Machine