Results 1 to 4 of 4

Thread: ini trouble

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    when I input a string value from an INI file, there is something tacked on to the end of it. I set the length of the returned string to 50 and used RTrim() to remove the trailing spaces, but when I go into debug mode and hover the mouse over the string it has a thick "|" on the end. What the hell is that?

    Also, i looked at what the ascii value of that thick "|" was and it said it was 0.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2

  3. #3

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    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
    
    Public Sub getSett()
    Dim Temp As String * 30
        ret = GetPrivateProfileString("Directories", "SharedDir", lpFileName, Temp, Len(Temp), lpFileName)
        If ret = 0 Then
            Beep
        Else
            frmMain.ShareDir = RTrim(Temp)
        End If
        Temp = ""
        ret = GetPrivateProfileString("Directories", "DestDir", lpFileName, Temp, Len(Temp), lpFileName)
        If ret = 0 Then
            Beep
        Else
            frmMain.NewDir = RTrim(Temp)
        End If
    End Sub
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    GetPrivateProfileString returns the length of the string.
    Here is some xode that works.
    Code:
        sBuffer = Space$(99)
        nDummy = GetPrivateProfileString("Defaults", "IntegrationType1", "", sBuffer, 99, gsIniName)
        gsDefIntegType1 = Left$(sBuffer, nDummy)

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