mSettingIO.bas
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:24k
源码类别:
浏览器
开发平台:
Visual Basic
- Attribute VB_Name = "mSettingIO"
- '保存加载程序设定
- Option Explicit
- Public Const File_Config As String = "Config.dat"
- Public Const StgName_Proxy As String = "proxy"
- Public Const StgName_MoreFav As String = "morefav"
- Public Const StgName_PageRule As String = "pagerule"
- Public Const StgName_UrlFilter As String = "urlfilter"
- '=============== 过滤列表 ==================
- Public Sub LoadUrlFilter()
- Dim tStg As cStorage
- Dim i& ', tLn&
- Set tStg = New cStorage
- If tStg.OpenFile(AppPath & File_Config, StgName_UrlFilter) Then
- UrlFilterCount = tStg.GetInteger()
- ReDim UrlFilter(0 To UrlFilterCount)
- For i = 1 To UrlFilterCount
- UrlFilter(i) = tStg.GetString()
- Next i
- End If
- 'Dim tFN&
- 'Dim i&, tLn&
- 'tFN = FreeFile
- 'Open AppPath & "urlfilter.dat" For Binary As tFN
- ' Get tFN, , UrlFilterCount
- ' ReDim UrlFilter(0 To UrlFilterCount)
- ' For i = 1 To UrlFilterCount
- ' Get tFN, , tLn
- ' UrlFilter(i) = StrConv(InputB(tLn, tFN), vbUnicode)
- ' Next i
- 'Close tFN
- End Sub
- Public Sub SaveUrlFilter()
- On Error Resume Next
- Dim tStg As cStorage
- Dim i&, tLn&
- Set tStg = New cStorage
- If tStg.OpenFile(AppPath & File_Config, StgName_UrlFilter) Then
- tStg.PutInteger UrlFilterCount
- For i = 1 To UrlFilterCount
- tStg.WriteString UrlFilter(i)
- Next i
- End If
- 'Dim tFN&
- 'Dim i&, tLn&
- 'tFN = FreeFile
- 'Open AppPath & "urlfilter.dat" For Binary As tFN
- ' Put tFN, , UrlFilterCount
- ' For i = 1 To UrlFilterCount
- ' tLn = LenB(StrConv(UrlFilter(i), vbFromUnicode))
- ' Put tFN, , tLn
- ' Put tFN, , UrlFilter(i)
- ' Next i
- 'Close tFN
- End Sub
- '=================================================
- ''=========外部工具==============================
- 'Public Sub LoadExTools()
- 'Dim tIniFile As cINIFile
- 'Dim i&, ti$
- 'Set tIniFile = New cINIFile
- 'With tIniFile
- ' .IniFile = AppPath & MainIniName
- ' ExToolsCount = Val(.ReadKey("ExTools", "ToolsCount", "0"))
- ' ReDim ExTools(0 To ExToolsCount)
- ' For i = 1 To ExToolsCount
- ' ti = LTrim$(Str(i))
- ' ExTools(i).Caption = .ReadKey("ExTools", "Caption" & ti)
- ' ExTools(i).path = .ReadKey("ExTools", "Path" & ti)
- ' ExTools(i).Param = .ReadKey("ExTools", "Param" & ti)
- ' Next i
- 'End With
- 'End Sub
- '
- 'Public Sub SaveExTools()
- 'Dim tIniFile As cINIFile
- 'Dim i&, ti$
- 'Set tIniFile = New cINIFile
- 'With tIniFile
- ' .IniFile = AppPath & MainIniName
- ' Call .DeleteSection("ExTools")
- ' Call .WriteKey("ExTools", "ToolsCount", Str(ExToolsCount))
- ' For i = 1 To ExToolsCount
- ' ti = LTrim$(Str(i))
- ' Call .WriteKey("ExTools", "Caption" & ti, ExTools(i).Caption)
- ' Call .WriteKey("ExTools", "Path" & ti, ExTools(i).path)
- ' Call .WriteKey("ExTools", "Param" & ti, ExTools(i).Param)
- ' Next i
- 'End With
- 'End Sub
- ''=================================================
- '===========下载控制===================================
- Public Sub LoadDownloadControl()
- Dim tIniFile As cINIFile
- Const tSec As String = "DownloadControl"
- 'Dim tVal As Integer
- Set tIniFile = New cINIFile
- With tIniFile
- .IniFile = AppPath & MainIniName
- gDL_Image = (.ReadInt(tSec, "Image", 1) = 1)
- gDL_BgSound = (.ReadInt(tSec, "BgSound", 1) = 1)
- gDL_Video = (.ReadInt(tSec, "Video", 1) = 1)
- gDL_ActiveX = (.ReadInt(tSec, "ActiveX", 1) = 1)
- gDL_Script = (.ReadInt(tSec, "Script", 1) = 1)
- gDL_JavaApplet = (.ReadInt(tSec, "JavaApplet", 1) = 1)
- gDl_DlActiveX = (.ReadInt(tSec, "DlActiveX", 0) = 1)
- ' gDL_Image = (Val(.ReadKey(tSec, "Image", "1")) = 1)
- ' gDL_BgSound = (Val(.ReadKey(tSec, "BgSound", "1")) = 1)
- ' gDL_Video = (Val(.ReadKey(tSec, "Video", "1")) = 1)
- ' gDL_ActiveX = (Val(.ReadKey(tSec, "ActiveX", "1")) = 1)
- ' gDL_Script = (Val(.ReadKey(tSec, "Script", "1")) = 1)
- ' gDL_JavaApplet = (Val(.ReadKey(tSec, "JavaApplet", "1")) = 1)
- ' gDl_NoDlActiveX = (Val(.ReadKey(tSec, "NoDlActiveX", "1")) = 1)
- ' tVal = Val(.ReadKey(tSec, "Image", "1"))
- ' If tVal = 1 Then
- ' gDL_Image = True
- ' Else
- ' gDL_Image = False
- ' End If
- '
- ' tVal = Val(.ReadKey(tSec, "BgSound", "1"))
- ' If tVal = 1 Then
- ' gDL_BgSound = True
- ' Else
- ' gDL_BgSound = False
- ' End If
- '
- ' tVal = Val(.ReadKey(tSec, "Video", "1"))
- ' If tVal = 1 Then
- ' gDL_Video = True
- ' Else
- ' gDL_Video = False
- ' End If
- '
- ' tVal = Val(.ReadKey(tSec, "ActiveX", "1"))
- ' If tVal = 1 Then
- ' gDL_ActiveX = True
- ' Else
- ' gDL_ActiveX = False
- ' End If
- '
- ' tVal = Val(.ReadKey(tSec, "Script", "1"))
- ' If tVal = 1 Then
- ' gDL_Script = True
- ' Else
- ' gDL_Script = False
- ' End If
- '
- ' tVal = Val(.ReadKey(tSec, "JavaApplet", "1"))
- ' If tVal = 1 Then
- ' gDL_JavaApplet = True
- ' Else
- ' gDL_JavaApplet = False
- ' End If
- '
- ' tVal = Val(.ReadKey(tSec, "NoDlActiveX", "1"))
- ' gDl_NoDlActiveX = (tVal = 1)
- End With
- End Sub
- Public Sub SaveDownloadControl()
- Dim tIniFile As cINIFile
- Const tSec As String = "DownloadControl"
- 'Dim tVal As String
- Set tIniFile = New cINIFile
- With tIniFile
- .IniFile = AppPath & MainIniName
- Call .WriteKey(tSec, "Video", BooleanToBool(gDL_Video))
- Call .WriteKey(tSec, "Image", BooleanToBool(gDL_Image))
- Call .WriteKey(tSec, "BgSound", BooleanToBool(gDL_BgSound))
- Call .WriteKey(tSec, "ActiveX", BooleanToBool(gDL_ActiveX))
- Call .WriteKey(tSec, "Script", BooleanToBool(gDL_Script))
- Call .WriteKey(tSec, "JavaApplet", BooleanToBool(gDL_JavaApplet))
- Call .WriteKey(tSec, "DlActiveX", BooleanToBool(gDl_DlActiveX))
- ' If gDL_Video Then tVal = "1" Else tVal = "0"
- ' Call .WriteKey(tSec, "Video", tVal)
- '
- ' If gDL_Image Then tVal = "1" Else tVal = "0"
- ' Call .WriteKey(tSec, "Image", tVal)
- '
- ' If gDL_BgSound Then tVal = "1" Else tVal = "0"
- ' Call .WriteKey(tSec, "BgSound", tVal)
- '
- ' If gDL_ActiveX Then tVal = "1" Else tVal = "0"
- ' Call .WriteKey(tSec, "ActiveX", tVal)
- '
- ' If gDL_Script Then tVal = "1" Else tVal = "0"
- ' Call .WriteKey(tSec, "Script", tVal)
- '
- ' If gDL_JavaApplet Then tVal = "1" Else tVal = "0"
- ' Call .WriteKey(tSec, "JavaApplet", tVal)
- '
- ' If gDl_NoDlActiveX Then tVal = "1" Else tVal = "0"
- ' Call .WriteKey(tSec, "NoDlActiveX", tVal)
- End With
- End Sub
- '=====================================================
- '===========工具栏按钮====================
- 'Public Sub SaveTbrButton()
- 'Dim tIniFile As cINIFile
- 'Dim i&, tstr$
- 'Set tIniFile = New cINIFile
- 'With tIniFile
- ' .IniFile = AppPath & MainIniName
- '
- ' tstr = ""
- ' For i = 0 To gTbrMainBtnCnt - 1
- ' tstr = tstr & LTrim$(Str$(gTbrMainBtnShow(i)))
- ' Next i
- ' Call .WriteKey("ToolbarButton", "Main", tstr)
- '
- ' tstr = ""
- ' For i = 0 To gTbrSmallBtnCnt - 1
- ' tstr = tstr & LTrim$(Str$(gTbrSmallBtnShow(i)))
- ' Next i
- ' Call .WriteKey("ToolbarButton", "Small", tstr)
- 'End With
- 'End Sub
- Public Sub SaveTbrButtonPos(vTbrType$, vObj() As cButtonPosInfo)
- Dim tIniFile As cINIFile
- Dim i&, tstr$
- Dim tcnt&, tKeyName$
- Select Case vTbrType
- Case "main"
- tcnt = gTbrMainBtnCnt
- tKeyName = "MainTbrButton"
- Case "small"
- tcnt = gTbrSmallBtnCnt
- tKeyName = "SmallTbrButton"
- Case Else
- Exit Sub
- End Select
- Set tIniFile = New cINIFile
- With tIniFile
- .IniFile = AppPath & MainIniName
- tstr = ""
- Dim tObj As New cButtonPosInfo
- tObj.SortByOOPos vObj
- For i = 0 To tcnt - 1
- If i = 0 Then
- tstr = vObj(i).GetSavePos()
- Else
- tstr = tstr & "," & vObj(i).GetSavePos()
- End If
- Next i
- Call .WriteKey("ToolbarButton", tKeyName, tstr)
- End With
- End Sub
- Public Sub LoadTbrButtonPos(vTbrType$, vArr() As Long)
- On Error Resume Next
- Dim tIniFile As cINIFile
- Dim i&, tstr$
- Dim tcnt&, tKeyName$
- Select Case vTbrType
- Case "main"
- tcnt = gTbrMainBtnCnt
- tKeyName = "MainTbrButton"
- Case "small"
- tcnt = gTbrSmallBtnCnt
- tKeyName = "SmallTbrButton"
- Case Else
- Exit Sub
- End Select
- Set tIniFile = New cINIFile
- tIniFile.IniFile = AppPath & MainIniName
- tstr = tIniFile.ReadKey("ToolbarButton", tKeyName)
- Dim tArr() As String
- tArr = Split(tstr, ",", tcnt)
- ReDim Preserve tArr(0 To tcnt - 1)
- ReDim vArr(0 To tcnt - 1)
- For i = 0 To tcnt - 1
- If Len(tArr(i)) = 0 Then
- vArr(i) = tcnt - 1
- Else
- vArr(i) = Val(tArr(i))
- End If
- Next i
- End Sub
- Public Sub LoadTbrButton()
- On Error Resume Next
- Dim tIniFile As cINIFile
- Dim i&, tstr$
- Set tIniFile = New cINIFile
- With tIniFile
- .IniFile = AppPath & MainIniName
- tstr = .ReadKey("ToolbarButton", "Main", String(gTbrMainBtnCnt, "1"))
- If Len(tstr) <> gTbrMainBtnCnt Then tstr = String(gTbrMainBtnCnt, "1")
- For i = 0 To gTbrMainBtnCnt - 1
- gTbrMainBtnShow(i) = Val(Mid(tstr, i + 1, 1))
- Next i
- tstr = .ReadKey("ToolbarButton", "Small", String(gTbrSmallBtnCnt, "1"))
- If Len(tstr) <> gTbrSmallBtnCnt Then tstr = String(gTbrSmallBtnCnt, "1")
- For i = 0 To gTbrSmallBtnCnt - 1
- gTbrSmallBtnShow(i) = Val(Mid(tstr, i + 1, 1))
- Next i
- End With
- End Sub
- '========================================
- '============窗口位置============================
- Public Sub SaveWindowState()
- Dim tIniFile As cINIFile
- Set tIniFile = New cINIFile
- With tIniFile
- .IniFile = AppPath & MainIniName
- Call .WriteKey("WindowState", "State", Str(gMainForm.WindowState))
- Call .WriteKey("WindowState", "Left", Str(gMainForm.Left / 15))
- Call .WriteKey("WindowState", "Top", Str(gMainForm.Top / 15))
- Call .WriteKey("WindowState", "Width", Str(gMainForm.width / 15))
- Call .WriteKey("WindowState", "Height", Str(gMainForm.height / 15))
- End With
- End Sub
- '==================================================
- '=========页面规则===============================
- Public Sub SavePageRule()
- Dim tStg As cStorage
- Dim i&, j&
- Set tStg = New cStorage
- If tStg.OpenFile(AppPath & File_Config, StgName_PageRule) Then
- tStg.PutInteger PageRuleCnt
- For i = 1 To PageRuleCnt
- With PageRule(i)
- tStg.WriteString .Title
- tStg.PutInteger .Enabled
- tStg.PutInteger .UrlCnt
- For j = 0 To .UrlCnt - 1
- tStg.WriteString .Urls(j)
- Next j
- tStg.PutInteger .Type
- If .Type = 0 Then
- tStg.PutInteger .AutoPreventPop
- tStg.PutInteger BooleanToBool(.DL_Image), 1
- tStg.PutInteger BooleanToBool(.DL_BgSound), 1
- tStg.PutInteger BooleanToBool(.DL_Video), 1
- tStg.PutInteger BooleanToBool(.DL_ActiveX), 1
- tStg.PutInteger BooleanToBool(.DL_Script), 1
- tStg.PutInteger BooleanToBool(.DL_JavaApplet), 1
- tStg.PutInteger BooleanToBool(.AllwaysOpenNew), 1
- tStg.PutInteger BooleanToBool(.Inherit), 1
- tStg.PutInteger BooleanToBool(.ForceChange), 1
- Else
- tStg.WriteString .OutExePath
- tStg.WriteString .OutExeParam
- End If
- End With
- Next i
- tStg.CloseFile
- End If
- 'Dim i&, j&, tByte As Byte
- 'Dim tBf As cBinaryFile
- '
- 'Set tBf = New cBinaryFile
- 'tBf.OpenFile AppPath & "pagerule.dat"
- 'tBf.PutLng PageRuleCnt
- '
- 'For i = 1 To PageRuleCnt
- ' With PageRule(i)
- ' tBf.WriteStringLng .Title
- ' tBf.PutLng .Enabled
- ' tBf.PutLng .UrlCnt
- ' For j = 0 To .UrlCnt - 1
- ' tBf.WriteStringLng .Urls(j)
- ' Next j
- ' tBf.PutLng .Type
- ' If .Type = 0 Then
- ' tBf.PutLng .AutoPreventPop
- '
- ' If .DL_Image Then tByte = 1 Else tByte = 0
- ' tBf.PutByte tByte
- '
- ' If .DL_BgSound Then tByte = 1 Else tByte = 0
- ' tBf.PutByte tByte
- '
- ' If .DL_Video Then tByte = 1 Else tByte = 0
- ' tBf.PutByte tByte
- '
- ' If .DL_ActiveX Then tByte = 1 Else tByte = 0
- ' tBf.PutByte tByte
- '
- ' If .DL_Script Then tByte = 1 Else tByte = 0
- ' tBf.PutByte tByte
- '
- ' If .DL_JavaApplet Then tByte = 1 Else tByte = 0
- ' tBf.PutByte tByte
- '
- ' If .AllwaysOpenNew Then tByte = 1 Else tByte = 0
- ' tBf.PutByte tByte
- '
- ' If .Inherit Then tByte = 1 Else tByte = 0
- ' tBf.PutByte tByte
- '
- ' If .ForceChange Then tByte = 1 Else tByte = 0
- ' tBf.PutByte tByte
- ' Else
- ' tBf.WriteStringLng .OutExePath
- ' tBf.WriteStringLng .OutExeParam
- ' End If
- ' End With
- 'Next i
- 'tBf.CloseFile
- End Sub
- Public Sub LoadPageRule()
- On Error GoTo due
- Dim tStg As cStorage
- Dim i&, j&, tByte As Byte
- Set tStg = New cStorage
- If tStg.OpenFile(AppPath & File_Config, StgName_PageRule) Then
- PageRuleCnt = tStg.GetInteger()
- ReDim PageRule(0 To PageRuleCnt)
- For i = 1 To PageRuleCnt
- With PageRule(i)
- .Title = tStg.GetString()
- .Enabled = tStg.GetInteger()
- .UrlCnt = tStg.GetInteger()
- If .UrlCnt > 0 Then ReDim .Urls(0 To .UrlCnt - 1)
- For j = 0 To .UrlCnt - 1
- .Urls(j) = tStg.GetString()
- Next j
- .Type = tStg.GetInteger()
- If .Type = 0 Then
- .AutoPreventPop = tStg.GetInteger()
- .DL_Image = (tStg.GetInteger(1) = 1)
- .DL_BgSound = (tStg.GetInteger(1) = 1)
- .DL_Video = (tStg.GetInteger(1) = 1)
- .DL_ActiveX = (tStg.GetInteger(1) = 1)
- .DL_Script = (tStg.GetInteger(1) = 1)
- .DL_JavaApplet = (tStg.GetInteger(1) = 1)
- .AllwaysOpenNew = (tStg.GetInteger(1) = 1)
- .Inherit = (tStg.GetInteger(1) = 1)
- .ForceChange = (tStg.GetInteger(1) = 1)
- Else
- .OutExePath = tStg.GetString()
- .OutExeParam = tStg.GetString()
- End If
- End With
- Next i
- tStg.CloseFile
- End If
- Exit Sub
- due:
- PageRuleCnt = 0
- 'ReDim PageRule(0 To PageRuleCnt)
- End Sub
- '==============================================
- '======== 拖拽 ======================
- Public Sub SaveDragDropSetting()
- Dim i&
- Dim tIni As cINIFile
- Dim tObj As cDragDropEvent
- Set tIni = New cINIFile
- With tIni
- .IniFile = AppPath & MainIniName
- For i = 0 To 3
- Set tObj = gDDEventImage(i)
- .WriteKey "DragDropEvent", "DDImage" & LTrim(Str(i)), _
- LTrim(Str(tObj.InsideIndex)) & "," & LTrim(Str(tObj.ReplaceItemIndex))
- Next i
- For i = 0 To 3
- Set tObj = gDDEventLink(i)
- .WriteKey "DragDropEvent", "DDLink" & LTrim(Str(i)), _
- LTrim(Str(tObj.InsideIndex)) & "," & LTrim(Str(tObj.ReplaceItemIndex))
- Next i
- For i = 0 To 3
- Set tObj = gDDEventText(i)
- .WriteKey "DragDropEvent", "DDText" & LTrim(Str(i)), _
- LTrim(Str(tObj.InsideIndex)) & "," & LTrim(Str(tObj.ReplaceItemIndex))
- Next i
- End With
- End Sub
- Public Sub LoadDragDropSetting()
- Dim i&
- Dim tIni As cINIFile
- Dim tObj As cDragDropEvent
- Dim tstr$
- Dim tArr() As String
- Set tIni = New cINIFile
- With tIni
- .IniFile = AppPath & MainIniName
- For i = 0 To 3
- Set tObj = gDDEventImage(i)
- tstr = .ReadKey("DragDropEvent", "DDImage" & LTrim(Str(i)), "0,0")
- If tstr <> "" Then
- tArr = Split(tstr, ",", 2)
- tObj.InsideIndex = tArr(0)
- If tObj.InsideIndex = tObj.SpIndex_Replace Then
- If UBound(tArr) = 1 Then
- tObj.ReplaceItemIndex = tArr(1)
- Else
- tObj.InsideIndex = 0
- End If
- End If
- End If
- Next i
- For i = 0 To 3
- Set tObj = gDDEventLink(i)
- tstr = .ReadKey("DragDropEvent", "DDLink" & LTrim(Str(i)), "0,0")
- If tstr <> "" Then
- tArr = Split(tstr, ",", 2)
- tObj.InsideIndex = tArr(0)
- If tObj.InsideIndex = tObj.SpIndex_Replace Then
- If UBound(tArr) = 1 Then
- tObj.ReplaceItemIndex = tArr(1)
- Else
- tObj.InsideIndex = 0
- End If
- End If
- End If
- Next i
- For i = 0 To 3
- Set tObj = gDDEventText(i)
- tstr = .ReadKey("DragDropEvent", "DDText" & LTrim(Str(i)), "0,0")
- If tstr <> "" Then
- tArr = Split(tstr, ",", 2)
- tObj.InsideIndex = tArr(0)
- If tObj.InsideIndex = tObj.SpIndex_Replace Then
- If UBound(tArr) = 1 Then
- tObj.ReplaceItemIndex = tArr(1)
- Else
- tObj.InsideIndex = 0
- End If
- End If
- End If
- Next i
- End With
- End Sub
- '=======================================
- '========== 搜索引擎 ======================
- Public Sub SaveSearchEgn()
- Dim i&
- Dim tIni As cINIFile
- Set tIni = New cINIFile
- With tIni
- .IniFile = AppPath & MainIniName
- .DeleteSection "SearchEngine"
- .WriteKey "SearchEngine", "Count", Str(gSearchEgnCount)
- .WriteKey "SearchEngine", "Default", Str(gDefaultEgn)
- For i = 1 To gSearchEgnCount
- .WriteKey "SearchEngine", "Title" & LTrim(Str(i)), gSearchEgn(i).Title
- .WriteKey "SearchEngine", "Url" & LTrim(Str(i)), gSearchEgn(i).Url
- '.WriteKey "SearchEngine", "Mul" & LTrim(Str(i)), Str(BooleanToBool(gSearchEgn(i).MulSearch))
- Next i
- End With
- End Sub
- Public Sub LoadSearchEgn()
- On Error GoTo due
- Dim i&
- Dim tIni As cINIFile
- Set tIni = New cINIFile
- With tIni
- .IniFile = AppPath & MainIniName
- gSearchEgnCount = .ReadInt("SearchEngine", "Count", 0)
- gDefaultEgn = .ReadInt("SearchEngine", "Default", 1)
- ReDim gSearchEgn(0 To gSearchEgnCount)
- pMnu_Searchbar.ClearItems
- For i = 1 To gSearchEgnCount
- gSearchEgn(i).Title = .ReadKey("SearchEngine", "Title" & LTrim(Str(i)), " ")
- gSearchEgn(i).Url = .ReadKey("SearchEngine", "Url" & LTrim(Str(i)))
- 'gSearchEgn(i).MulSearch = BoolToBoolean(Val(.ReadKey("SearchEngine", "Mul" & LTrim(Str(i)), "0")))
- 'pMnu_Searchbar.Add gSearchEgn(i).Title, , i
- 'pMnu_Searchbar.CheckItem i, gSearchEgn(i).MulSearch, True
- Next i
- End With
- If gSearchEgnCount > 0 Then
- If gDefaultEgn <= 0 Or gDefaultEgn > gSearchEgnCount Then
- gDefaultEgn = 1
- End If
- 'pMnu_Searchbar.SetDefault gDefaultEgn, True
- Else
- gDefaultEgn = 0
- End If
- Call LoadSearchEgnMenu
- Exit Sub
- due:
- gSearchEgnCount = 0
- gDefaultEgn = 0
- ReDim gSearchEgn(0 To 0)
- pMnu_Searchbar.ClearItems
- End Sub
- Public Sub LoadSearchEgnMenu()
- Dim i&
- Dim tTle$
- Dim tcnt&
- If pMnu_Searchbar Is Nothing Then
- Set pMnu_Searchbar = New cPopMenu
- pMnu_Searchbar.Create
- End If
- pMnu_Searchbar.ClearItems
- tcnt = 1
- For i = 1 To gSearchEgnCount
- tTle = gSearchEgn(i).Title
- If tTle = "-" Then
- pMnu_Searchbar.Add "", pmsSeparator
- Else
- If tcnt <= 10 Then
- tTle = "&" & Trim(Str(tcnt Mod 10)) & " " & tTle
- Else
- tTle = " " & tTle
- End If
- pMnu_Searchbar.Add tTle, , i
- tcnt = tcnt + 1
- End If
- Next i
- End Sub
- '===================================================
- '============= 多引擎搜索 =====================
- Public Sub SaveMulSearchEgn()
- Dim i&
- Dim tIni As cINIFile
- Set tIni = New cINIFile
- With tIni
- .IniFile = AppPath & MainIniName
- .DeleteSection "MulSearch"
- .WriteKey "MulSearch", "Count", Str(gMulSearchCount)
- .WriteKey "MulSearch", "Default", Str(gDefaultMulEgn)
- For i = 1 To gMulSearchCount
- .WriteKey "MulSearch", "Title" & LTrim(Str(i)), gMulSearch(i).Title
- .WriteKey "MulSearch", "Data" & LTrim(Str(i)), _
- MakeMulsearchData(gMulSearch(i).UseMul, _
- gMulSearch(i).Count)
- Next i
- End With
- End Sub
- Private Function MakeMulsearchData(vArr() As Boolean, vCount&) As String
- Dim i&, rtn$
- For i = 1 To vCount
- If vArr(i) Then
- rtn = rtn & "1"
- Else
- rtn = rtn & "0"
- End If
- Next i
- MakeMulsearchData = rtn
- End Function
- Private Sub SplitMulsearchData(vArr() As Boolean, vCount&, vData$)
- Dim i&
- ReDim vArr(0 To vCount)
- For i = 1 To vCount
- vArr(i) = (Mid(vData, i, 1) = "1")
- Next i
- End Sub
- Public Sub LoadMulSearchEgn()
- On Error GoTo due
- Dim i&, tstr$
- Dim tIni As cINIFile
- Set tIni = New cINIFile
- With tIni
- .IniFile = AppPath & MainIniName
- gMulSearchCount = .ReadInt("MulSearch", "Count", 0)
- gDefaultMulEgn = .ReadKey("MulSearch", "Default", 1)
- ReDim gMulSearch(0 To gMulSearchCount)
- pMnu_MulSearch.ClearItems
- For i = 1 To gMulSearchCount
- gMulSearch(i).Title = .ReadKey("MulSearch", "Title" & LTrim(Str(i)), " ")
- gMulSearch(i).Count = gSearchEgnCount
- tstr = .ReadKey("MulSearch", "Data" & LTrim(Str(i)), "0")
- SplitMulsearchData gMulSearch(i).UseMul, gMulSearch(i).Count, tstr
- Next i
- End With
- If gMulSearchCount > 0 Then
- If gDefaultMulEgn <= 0 Or gDefaultMulEgn > gMulSearchCount Then
- gDefaultMulEgn = 1
- End If
- Else
- gDefaultMulEgn = 0
- End If
- Call LoadMulSearchEgnMenu
- Exit Sub
- due:
- gMulSearchCount = 0
- gDefaultMulEgn = 0
- ReDim gMulSearch(0 To 0)
- pMnu_MulSearch.ClearItems
- End Sub
- Public Sub LoadMulSearchEgnMenu()
- Dim i&
- If pMnu_MulSearch Is Nothing Then
- Set pMnu_MulSearch = New cPopMenu
- pMnu_MulSearch.Create
- End If
- pMnu_MulSearch.ClearItems
- For i = 1 To gMulSearchCount
- pMnu_MulSearch.Add gMulSearch(i).Title, , i
- Next i
- End Sub
- '===========================================
- '============ 下载工具 ==========================
- '---------------------------------------------------------------------------------------
- ' DateTime : 2005-8-15 00:02
- ' Author : Lingll
- ' Purpose :
- '---------------------------------------------------------------------------------------
- Public Sub LoadDownManager()
- Dim tIni As cINIFile
- Const tSecN$ = "Download"
- Set tIni = New cINIFile
- tIni.IniFile = AppPath & MainIniName
- gShowDownDlg = BooleanToBool(tIni.ReadInt(tSecN, "ShowDownDlg") = 1)
- gUseDownTool = BooleanToBool(tIni.ReadInt(tSecN, "UseDownTool") = 1)
- gDownToolIndex = tIni.ReadInt(tSecN, "ToolIndex")
- Call LoadDownTools
- If gDownToolCount > 0 Then
- If gDownToolIndex > gDownToolCount Or gDownToolIndex < 1 Then
- gDownToolIndex = 1
- End If
- Else
- gDownToolIndex = 0
- End If
- End Sub
- Public Sub LoadDownTools()
- Dim i&
- Dim tIni As cINIFile
- Const tSecN$ = "DownManager"
- Set tIni = New cINIFile
- tIni.IniFile = AppPath & "DownManagerlist.ini"
- gDownToolCount = tIni.ReadInt(tSecN$, "count")
- If gDownToolCount > 0 Then
- ReDim gDownTools(0 To gDownToolCount)
- For i = 1 To gDownToolCount
- gDownTools(i).Title = tIni.ReadKey(tSecN$, "N" & LTrim(Str(i)), "item")
- gDownTools(i).Url = tIni.ReadKey(tSecN$, "F" & LTrim(Str(i)), "item")
- Next i
- Else
- gDownToolCount = 0
- ReDim gDownTools(0 To 0)
- End If
- End Sub
- Public Sub SaveDownManager()
- Dim tIni As cINIFile
- Const tSecN$ = "Download"
- Set tIni = New cINIFile
- tIni.IniFile = AppPath & MainIniName
- Call tIni.WriteKey(tSecN, "ShowDownDlg", Str(gShowDownDlg))
- Call tIni.WriteKey(tSecN, "UseDownTool", Str(gUseDownTool))
- Call tIni.WriteKey(tSecN, "ToolIndex", Str(gDownToolIndex))
- End Sub
- '==================================================