title: Reading from an INI file
body: <p>I find it very easy to write to a INI file, but am having some trouble in retrieving the data from an already created INI file.</p>
  
  <p>I am using this function:</p>
  
  <pre><code>    Public Declare Unicode Function GetPrivateProfileString Lib "kernel32" _
      Alias "GetPrivateProfileStringW" (ByVal lpApplicationName As String, _
      ByVal lpKeyName As String, ByVal lpDefault As String, _
      ByVal lpReturnedString As String, ByVal nSize As Int32, _
      ByVal lpFileName As String) As Int32
  </code></pre>
  
  <p>If I have an INI file called 'c:\temp\test.ini', with the following data:</p>
  
  <pre><code>[testApp]
  KeyName=keyValue
  KeyName2=keyValue2
  </code></pre>
  
  <p>How can I retrieve the values of KeyName and KeyName2?</p>
  
  <p>I have tried this code, with no success:</p>
  
  <pre><code>    Dim strData As String
      GetPrivateProfileString("testApp", "KeyName", "Nothing", strData, Len(strData), "c:\temp\test.ini")
      MsgBox(strData)
  </code></pre>