前端之家收集整理的这篇文章主要介绍了
[VB.NET]读写ini,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
- PrivateDeclareFunctionGetPrivateProfileStringLib"kernel32"Alias"GetPrivateProfileStringA"(ByVallpApplicationNameAsString,ByVallpKeyNameAsString,ByVallpDefaultAsString,ByVallpReturnedStringAsString,ByValnSizeAsInt32,ByVallpFileNameAsString)AsInt32
- PrivateDeclareFunctionWritePrivateProfileStringLib"kernel32"Alias"WritePrivateProfileStringA"(ByVallpApplicationNameAsString,ByVallpStringAsString,ByVallpFileNameAsString)AsInt32
- PublicFunctionGetINI(ByValSectionAsString,ByValAppNameAsString,ByValFileNameAsString)AsString
- DimStrAsString=LSet(Str,256)
- GetPrivateProfileString(Section,AppName,lpDefault,Str,Len(Str),FileName)
- ReturnMicrosoft.VisualBasic.Left(Str,InStr(Str,Chr(0))-1)
- EndFunction
- PublicFunctionWriteINI(ByValSectionAsString,ByValFileNameAsString)AsLong
- WriteINI=WritePrivateProfileString(Section,FileName)
- EndFunction
- DimTempStrAsString=Application.StartupPath&"/Option.ini"
- ValuesStr=GetINI("runoption","refresh","",TempStr)
- WriteINI("runoption","autoin",TempValues,TempStr)’写ini
原文链接:https://www.f2er.com/vb/264405.html