'--------------------------------------------------------------------------- ' ' GetProfile() - Get a value or enumerate keys in CGI_Profile file ' ' Get a value given the section and key, or enumerate keys given the ' section name and "" for the key. If enumerating, the list of keys for ' the given section is returned as a null-separated string, with a ' double null at the end. ' ' VB handles this with flair! I couldn't believe my eyes when I tried this. '--------------------------------------------------------------------------- Private Function GetProfile(sSection As String, sKey As String) As String Dim retLen As Long Dim buf As String * ENUM_BUF_SIZE If sKey <> "" Then retLen = GetPrivateProfileString(sSection, sKey, "", buf, ENUM_BUF_SIZE, CGI_ProfileFile) Else retLen = GetPrivateProfileString(sSection, 0&, "", buf, ENUM_BUF_SIZE, CGI_ProfileFile) End If If retLen = 0 Then GetProfile = "" Else GetProfile = Left$(buf, retLen) End If End Function