读取和写入Windows的INI文件 2012-07-30 21:34:49| 分类: 【VB&编程】 | 标签: |字号大中小 订阅 .
Sub WriteINIStringVirtual(Section, KeyName, value, FileName)
WriteINIString Section, KeyName, value, _
Server.MapPath(FileName)
End Sub
Function GetINIStringVirtual()Function GetINIStringVirtual(Section, KeyName, Default, FileName)
GetINIStringVirtual = GetINIString(Section, KeyName, Default, _
Server.MapPath(FileName))
End Function
'Work with INI files In VBS (ASP/WSH)
'v1.00
'Function GetINIString(Section, KeyName, Default, FileName)
'Sub WriteINIString(Section, KeyName, value, FileName)
Sub WriteINIString()Sub WriteINIString(Section, KeyName, value, FileName)
Dim INIContents, PosSection, PosEndSection
'Get contents of the INI file As a string
INIContents = GetFile(FileName)
'Find section
PosSection = InStr(1, INIContents, "[" & Section & "]", vbTextCompare)
If PosSection>0 Then
'Section exists. Find end of section
PosEndSection = InStr(PosSection, INIContents, vbCrLf & "[")
'?Is this last section?
If PosEndSection = 0 Then PosEndSection = Len(INIContents)+1
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余4页未读,立即下载