Private Declare Auto Function WritePrivateProfileString Lib "kernel32" _ (ByVal lpApplication As String, _ ByVal lpKeyName As String, _ ByVal lpString As String, _ ByVal lpFileName As String) As Integerand this method:
' Write a Main.ini file value ' expC1 File ' expC2 Section ' expC3 Key ' expC4 Value Public Function WriteIni(ByVal tcIniPath As String, _ ByVal tcSectionName As String, ByVal tcKeyName As String, ByVal tcValue As String) As Boolean Dim lnResult As Integer = 0 lnResult = WritePrivateProfileString(tcSectionName, tcKeyName, tcValue, tcIniPath) ' If we were unable to write into the INI file If lnResult = 0 Then Return False End If Return True End FunctionOn the Web site directory, I have Main.ini. I can call WriteIni() and replace a value in it. This works ok. But, if I go in Windows Explorer, right click Copy, right click Paste, and rename the file to Main2.ini, this wouldn't work anymore. As soon as I make a copy of Main.ini to something else by the use of Windows Explorer, I can no longer use WriteIni(). It simply cannot write anymore to the file. It seems Windows changes the codepage of that file and this confuses WritePrivateProfileString().