PluginSideband.cls
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:8k
源码类别:
浏览器
开发平台:
Visual Basic
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- Persistable = 0 'NotPersistable
- DataBindingBehavior = 0 'vbNone
- DataSourceBehavior = 0 'vbNone
- MTSTransactionMode = 0 'NotAnMTSObject
- END
- Attribute VB_Name = "cPluginSideband"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- '---------------------------------------------------------------------------------------
- ' Module : cPluginSideband
- ' DateTime : 2005-5-28 21:20
- ' Author : Lingll
- ' Purpose : 插件,边栏sideband
- '---------------------------------------------------------------------------------------
- Option Explicit
- '插件数据--com插件
- Private Type PluginData_Com
- 'Title As String
- 'FileName As String
- ObjectName As String
- ClassID As String
- End Type
- ''插件数据--html插件
- 'Private Type PluginData_Html
- '
- 'End Type
- Public Title As String '名称,对应于菜单或按钮显示的文字
- Public FileName As String '要执行的文件名,exe | ini
- Public Param As String
- Public VisInMenu As Long '是否在"插件菜单"中显示
- Public IconFile As String
- Private ModuleType As String 'script,exe,com,dll,sendkey
- Private PluginType As String 'command,sideband,toolband,
- '也就是执行与存在方式,对应的是命令,侧边栏,工具栏
- Private o_FileName As String 'ini中指向的真实文件名
- Private o_Title As String 'ini文件中的Title
- Private mData_Com As PluginData_Com
- 'Private Const m_MTStr_Script As String = "script"
- 'Private Const m_MTStr_Exe As String = "exe"
- Private Const m_MTStr_Com As String = "com"
- Private Const m_MTStr_Html As String = "html"
- 'Private Const m_MTStr_Dll As String = "dll"
- 'Private Const m_MTStr_Sendkey As String = "sendkey"
- Private m_SideBand As LEPluginLib.ILESideBand
- '是否第一次显示,用来加速程序启动速度
- Private m_firstShow As Boolean
- 'Private mPluginData As PluginData
- '---------------------------------------------------------------------------------------
- ' Procedure : LoadSideBand
- ' DateTime : 2005-5-28 21:55
- ' Author : Lingll
- ' Purpose : 加载sideband(初始化)
- '---------------------------------------------------------------------------------------
- Public Sub LoadSideBand()
- On Error Resume Next
- Dim tPath$, tParam$
- Select Case LCase$(ModuleType)
- Case m_MTStr_Com
- Call LoadSideBand_Com
- Case m_MTStr_Html
- Call LoadSideBand_Html
- End Select
- End Sub
- '---------------------------------------------------------------------------------------
- ' Procedure : LoadSideBand_Com
- ' DateTime : 2005-5-28 21:57
- ' Author : Lingll
- ' Purpose : (加载dll)
- '---------------------------------------------------------------------------------------
- Private Sub LoadSideBand_Com()
- On Error Resume Next
- Dim tObj As LEPluginLib.ILESideBand
- Dim tDll As cCrDllObj
- Set tDll = New cCrDllObj
- tDll.IniClsId mData_Com.ClassID
- Set tObj = tDll.CreateMyDllObject(TranslatePath2(o_FileName))
- If tObj Is Nothing Then
- ErrorLog.AddLog "LoadSideBand_Com,some error..."
- Else
- Set m_SideBand = tObj
- Set tObj = Nothing
- End If
- End Sub
- '---------------------------------------------------------------------------------------
- ' Procedure : LoadSideBand_Html
- ' DateTime : 2005-6-14 20:59
- ' Author : Lingll
- ' Purpose :
- '---------------------------------------------------------------------------------------
- Private Sub LoadSideBand_Html()
- Dim tFrm As frmSideBandHtml
- Set tFrm = New frmSideBandHtml
- Load tFrm
- Set m_SideBand = tFrm
- 'tFrm.Navigate TranslatePath2(o_FileName)
- Set tFrm = Nothing
- End Sub
- Private Function TranslatePath(vPath$) As String
- Dim tPath$
- Dim tSysDir$
- tPath = vPath
- tPath = Replace(tPath, "%app%", App.path, , , vbTextCompare)
- tPath = Replace(tPath, "%windir%", Environ("windir"), , , vbTextCompare)
- If InStr(1, tPath, "%system%", vbTextCompare) > 0 Then
- If IsWinNT() Then
- tSysDir = Environ("windir") & "system32"
- Else
- tSysDir = Environ("windir") & "system"
- End If
- tPath = Replace(tPath, "%system%", tSysDir, , , vbTextCompare)
- End If
- TranslatePath = tPath
- End Function
- '用于有 . 的情况
- Private Function TranslatePath2(vPath$) As String
- TranslatePath2 = TranslatePath(Replace(vPath, ".", GetFileFolder(FileName) & ""))
- End Function
- 'Private Function TranslateParam(vParam$) As String
- 'Dim tParam$
- ' tParam = vParam
- ' If loadedBrowserCount > 0 Then
- ' tParam = Replace(tParam, "%url%", webbState(gActiveWebIndex).webForm.GetWebUrl, , , vbTextCompare)
- ' tParam = Replace(tParam, "%WebWinHwnd%", webbState(gActiveWebIndex).webForm.hWnd, , , vbTextCompare)
- ' Else
- ' tParam = Replace(tParam, "%url%", "", , , vbTextCompare)
- ' tParam = Replace(tParam, "%WebWinHwnd%", "", , , vbTextCompare)
- ' End If
- 'TranslateParam = tParam
- 'End Function
- Public Sub Reload()
- If FileExist(TranslatePath(FileName)) Then
- If LCase$(GetExtendName(FileName)) = "ini" Then
- Call ReadData
- End If
- End If
- End Sub
- '---------------------------------------------------------------------------------------
- ' Procedure : ReadData
- ' DateTime : 2005-5-28 18:47
- ' Author : Lingll
- ' Purpose : 读取插件详细数据
- '---------------------------------------------------------------------------------------
- Private Sub ReadData()
- Dim tIni As cINIFile
- Set tIni = New cINIFile
- tIni.IniFile = TranslatePath(FileName)
- If Trim(tIni.ReadKey("General", "Flag")) = LEPluginFlag Then
- If LCase(Trim(tIni.ReadKey("General", "PluginType"))) = PluginTypeTag_SideBand Then
- o_FileName = tIni.ReadKey("General", "FileName")
- o_Title = tIni.ReadKey("General", "Title")
- ModuleType = LCase$(Trim$(tIni.ReadKey("General", "ModuleType")))
- IconFile = tIni.ReadKey("General", "IconFile")
- Select Case ModuleType
- Case m_MTStr_Com
- mData_Com.ClassID = tIni.ReadKey(m_MTStr_Com, "ClassID")
- mData_Com.ObjectName = tIni.ReadKey(m_MTStr_Com, "ObjectName")
- Case m_MTStr_Html
- End Select
- End If
- End If
- End Sub
- '---------------------------------------------------------------------------------------
- ' Procedure : ShowBand
- ' DateTime : 2005-5-29 21:21
- ' Author : Lingll
- ' Purpose :
- '---------------------------------------------------------------------------------------
- Public Sub ShowBand(bShow As Boolean)
- If Not m_SideBand Is Nothing Then
- If bShow And m_firstShow And ModuleType = m_MTStr_Html Then
- Dim tFrm As frmSideBandHtml
- Set tFrm = m_SideBand
- tFrm.Navigate TranslatePath2(o_FileName)
- m_firstShow = False
- End If
- m_SideBand.ShowBand bShow
- End If
- End Sub
- '---------------------------------------------------------------------------------------
- ' Procedure : SetSite
- ' DateTime : 2005-5-29 21:23
- ' Author : Lingll
- ' Purpose :
- '---------------------------------------------------------------------------------------
- Public Sub SetSite(hParent&)
- If m_SideBand Is Nothing Then
- Call LoadSideBand
- End If
- If Not m_SideBand Is Nothing Then
- m_SideBand.SetSite hParent, gOutInfo
- End If
- End Sub
- '---------------------------------------------------------------------------------------
- ' Procedure : Resize
- ' DateTime : 2005-5-29 21:23
- ' Author : Lingll
- ' Purpose :
- '---------------------------------------------------------------------------------------
- Public Sub Resize(x&, y&, cx&, cy&)
- If Not m_SideBand Is Nothing Then
- m_SideBand.Resize x&, y&, cx, cy
- End If
- End Sub
- Public Function GetModuleTypeIndex() As Long
- Select Case LCase$(ModuleType)
- ' Case m_MTStr_Script
- ' GetModuleTypeIndex = 0
- ' Case m_MTStr_Exe
- ' GetModuleTypeIndex = 1
- Case m_MTStr_Com
- GetModuleTypeIndex = 2
- ' Case m_MTStr_Dll
- ' GetModuleTypeIndex = 3
- ' Case m_MTStr_Sendkey
- ' GetModuleTypeIndex = 4
- ' Case Else
- ' GetModuleTypeIndex = 0
- End Select
- End Function
- Public Function Get_O_FileName() As String
- Get_O_FileName = TranslatePath2(o_FileName)
- End Function
- Public Function GetRealFileFolder() As String
- GetRealFileFolder = GetFileFolder(TranslatePath2(FileName))
- End Function
- Private Sub Class_Initialize()
- m_firstShow = True
- End Sub
- Private Sub Class_Terminate()
- If Not m_SideBand Is Nothing Then
- m_SideBand.CloseBand
- Set m_SideBand = Nothing
- End If
- End Sub