DOMU DOMU

Titulky
Progr.jazyky
Databßze
Inter/Intranet
COM
SystΘm(novΘ)
VS 6.0 (novΘ)

Katalog odkaz∙

  • Databßze
  • Internet / Intranet
  • Komponenty
  • Progr. jazyky
  • Win32

    Reklama





  • Aktußlnφ Φlßnky

    ╚tenφ a zßpis INI soubor∙

    Funkce umo₧≥ujφcφ Φφst a zapisovat do standartnφch INI soubor∙.

    '***************************************************************
    'Windows API/Global Declarations
    '***************************************************************
    '****************************************************
    '* INI_sm.BAS *
    '****************************************************
    Option Explicit


    #If Win16 Then


    Declare Function WritePrivateProfileString Lib "Kernel" (ByVal AppName As String, ByVal
    KeyName As String, ByVal NewString As String, ByVal filename As String) As Integer


    Declare Function GetPrivateProfileString Lib "Kernel" Alias "GetPrivateProfilestring"
    (ByVal AppName As String, ByVal KeyName As Any, ByVal default As String, ByVal ReturnedString As String, ByVal MAXSIZE As Integer, ByVal filename As String) As Integer
    #Else
    ' NOTE: The lpKeyName argument for GetProfileString, WriteProfile String,
    'GetPrivateProfileString, and WritePrivateProfileString can be either
    'a string or NULL. This is why the argument is defined as "As Any".
    ' For example, to pass a string specifyByVal "wallpaper"To pass NULL specifyByVal 0&
    'You can also pass NULL for the lpString argument for WriteProfil eString
    'and WritePrivateProfileString
    ' Below it has been changed to a string due to the ability to use vbNullString


    Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

    Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As Any, ByVal lpFileName As String) As Long
    #End If




    '***************************************************************
    ' Name: 16 and 32 bit functions to create
    ' Description:16 AND 32 bit functions to read/write ini files--ve
    ' ry useful!
    ' By: VB Qaid
    '***************************************************************

    Vytvo°te modul: INI_SM.BAS
    P°idejte atribut a kod: Attribute VB_Name = "ini_sm"
    '*******************************************************
    '* 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

    Michal Blßha (SPRINX)
    blaha@sprinx.cz
    22.6.1999


    (c) 1998 SPRINX s.r.o. a auto°i Φlßnk∙.
    redakce@developer.cz