Attribute VB_Name = "modPub"
Option Explicit
Public strAppPath$
Public intFontSize As Integer
Public strFontColor As String
Public lngFontColor As Long
Public strSplit As String
Sub Main() strAppPath = App.Path If Right(strAppPath,1) <> "/" Then strAppPath = strAppPath & "/" iniFileName = strAppPath & "user.INI" If Dir(iniFileName) <> "" Then Call initFromIniFile Else Call initFromApp Call saveToIniFile End If Form1.ShowEnd Sub'从配置文件初始化Private Sub initFromIniFile()' On Error GoTo err1 intFontSize = Trim(GetIniS("UserSet","FontSize")) strFontColor = Trim(GetIniS("UserSet","FontColor")) lngFontColor = Val(strFontColor) strSplit = Trim(GetIniS("UserSet","Split ")) Exit Suberr1: Call initFromApp Call saveToIniFileEnd Sub'保存到配置文件Public Sub saveToIniFile() SetIniS "UserSet","FontSize",CStr(intFontSize) SetIniS "UserSet","FontColor",CStr(strFontColor) SetIniS "UserSet","Split",CStr(strSplit)End Sub'用程序自身初始化Private Sub initFromApp() intFontSize = 10 strFontColor = "&HFFFF&" lngFontColor = Val(strFontColor) strSplit = "---------------------------------"End Sub