Results 1 to 4 of 4

Thread: ini files

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Oshawa, Ontario, Canada
    Posts
    88

    Red face


    Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpkeyname As Any, ByVal lsstring As Any, ByVal lplfilename As String) As Long
    Public Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPriviteProfileIntA" (ByVal lpApplicationname As String, ByVal lpkeyname As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
    Public 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

    all this crap here is for the reading and writing ini files.
    what i need to know is how can you delete a piece of information from an ini file....could somebody help me please....

    -KnIgHt
    -icq 17743984

  2. #2
    Guest
    Code:
        Call WritePrivateProfileString(strsection$, UCase$(strkey$), "", strfullpath$)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Oshawa, Ontario, Canada
    Posts
    88

    Red face this is still not helping

    this is my module code

    Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpkeyname As Any, ByVal lsstring As Any, ByVal lplfilename As String) As Long
    Public Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPriviteProfileIntA" (ByVal lpApplicationname As String, ByVal lpkeyname As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
    Public 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



    ok....look at this code...
    this is my main code to work with ini files

    Option Explicit
    Public IniFileName As String
    Public appnames As String
    Public keynames As String
    Public strins As String
    Public returned As String

    Public Sub Getstring()
    Dim ret As Long
    Dim temp As String * 50
    Dim lpAppName As String, lpkeyname As String, lpDefault As String, lpFileName As String

    lpAppName = appnames
    lpkeyname = keynames
    lpDefault = IniFileName
    lpFileName = IniFileName


    ret = GetPrivateProfileString(lpAppName, lpkeyname, lpDefault, temp, Len(temp), lpFileName)

    returned = temp

    End Sub

    Public Sub Storestring()
    Dim lpAppName As String, lpFileName As String, lpkeyname As String, lpString As String
    Dim ret As Long
    lpAppName = appnames
    lpkeyname = keynames
    lpString = strins
    lpFileName = IniFileName
    ret = WritePrivateProfileString(lpAppName, lpkeyname, lpString, lpFileName)

    End Sub

    how do i make a procedure for something like a
    Public Sub DeleteString()???

    give me full details please

    -knight

  4. #4
    Guest
    Ok. Sorry for not explaining. What it will do is delete the value. What you want, correct?

    Code:
        Call WritePrivateProfileString("My Section", "Key", "", "C:\MyINI.ini")
    
    "" '<- erases key value

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width