vb 2008使用GetPrivateProfile系列函数的问题
本人新作工程 需要使用Ini文件的有关函数。调试过程中 发现 无论是GetPrivateProfileString还是GetPrivateProfileInt
如果文件名称设置为固定路径如“C:\Setting.ini”则读写Ini文件都没有问题。
一旦文件路径换成了相对路径,问题就来了:如文件路径为 My.Application.Info.DirectoryPath +"\Setting.Ini"。(该路径下存在该文件)。执行GetPrivateProfileSring(Int)后,就什么结果也不能返回。路径也被修改成My.Application.Info.DirectoryPath +"\Setting"。(后面的.Ini没有了)那位高手能帮忙分析一下哈?
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal SectionName As String, _
ByVal KeyName As String, ByVal Defaultstring As String, ByVal Value As String, ByVal Size As Integer, ByVal FileName As String) As Integer '在配置文件内读取字符串信息
Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As String, ByVal nDefault As Integer, ByVal lpFileName As String) As Integer
代码就不贴了。那位高手能帮忙分析一下哈?