|
Option Explicit
Private Sub Command1_Click()
If SSTab1.Tab = TAB_LEFT Then
WebBrowser1.Navigate2 LoadHomePage("Left")
End If
If SSTab1.Tab = TAB_RIGHT Then
WebBrowser2.Navigate2 LoadHomePage("Right")
End If
If SSTab1.Tab = TAB_XXX Then
WebBrowser3.Navigate2 LoadHomePage("XXX")
End If
End Sub
' ********************************************************
' ‰Šúˆ—
' ********************************************************
Private Sub Form_Load()
Dim strFileName
Dim strValue As String * 20
Dim X, Y, w, h
strFileName = App.Path & "\" & App.EXEName & ".ini"
Call GetPrivateProfileString( _
"Location", _
"Left", _
"0", _
strValue, _
20, _
strFileName _
)
X = strValue
Call GetPrivateProfileString( _
"Location", _
"Top", _
"0", _
strValue, _
20, _
strFileName _
)
Y = strValue
Call GetPrivateProfileString( _
"Location", _
"Width", _
"800", _
strValue, _
20, _
strFileName _
)
w = strValue
Call GetPrivateProfileString( _
"Location", _
"Height", _
"600", _
strValue, _
20, _
strFileName _
)
h = strValue
Call MoveWindow(Form1.hWnd, X, Y, w, h, 1)
WebBrowser1.Navigate2 LoadHomePage("Left")
WebBrowser2.Navigate2 LoadHomePage("Right")
WebBrowser3.Navigate2 LoadHomePage("XXX")
Text1.Visible = True
Text2.Visible = False
Text3.Visible = False
End Sub
' ********************************************************
' ƒTƒCƒY•ÏX
' ********************************************************
Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then
Exit Sub
End If
Dim rc As RECT
GetClientRect Me.hWnd, rc
With SSTab1
.Left = 0
.Top = Text1.Height
.Width = rc.Right
.Height = rc.Bottom - Text1.Height - StatusBar1.Height
End With
If SSTab1.Tab = TAB_LEFT Then
With WebBrowser1
.Left = 0
.Top = Me.ScaleY(SSTab1.TabHeight, vbPixels, vbTwips)
.Width = Me.ScaleX(SSTab1.Width, vbPixels, vbTwips)
.Height = Me.ScaleY(SSTab1.Height - SSTab1.TabHeight, vbPixels, vbTwips)
End With
With Text1
.Left = 0
.Top = 0
.Width = rc.Right - Command1.Width
End With
With Command1
.Left = Text1.Width
End With
End If
If SSTab1.Tab = TAB_RIGHT Then
With WebBrowser2
.Left = 0
.Top = Me.ScaleY(SSTab1.TabHeight, vbPixels, vbTwips)
.Width = Me.ScaleX(SSTab1.Width, vbPixels, vbTwips)
.Height = Me.ScaleY(SSTab1.Height - SSTab1.TabHeight, vbPixels, vbTwips)
End With
With Text2
.Left = 0
.Top = 0
.Width = rc.Right - Command1.Width
End With
With Command1
.Left = Text2.Width
End With
End If
If SSTab1.Tab = TAB_XXX Then
With WebBrowser3
.Left = 0
.Top = Me.ScaleY(SSTab1.TabHeight, vbPixels, vbTwips)
.Width = Me.ScaleX(SSTab1.Width, vbPixels, vbTwips)
.Height = Me.ScaleY(SSTab1.Height - SSTab1.TabHeight, vbPixels, vbTwips)
End With
With Text3
.Left = 0
.Top = 0
.Width = rc.Right - Command1.Width
End With
With Command1
.Left = Text3.Width
End With
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim nRect As RECT
Dim strFileName
If Me.WindowState = vbNormal Then
Call GetWindowRect(Form1.hWnd, nRect)
strFileName = App.Path & "\" & App.EXEName & ".ini"
Call WritePrivateProfileString( _
"Location", "Left", nRect.Left, strFileName)
Call WritePrivateProfileString( _
"Location", "Top", nRect.Top, strFileName)
Call WritePrivateProfileString( _
"Location", "Width", nRect.Right - nRect.Left + 1, strFileName)
Call WritePrivateProfileString( _
"Location", "Height", nRect.Bottom - nRect.Top + 1, strFileName)
End If
End Sub
' ********************************************************
' ƒJƒŒƒ“ƒg‚Ì•ÏX
' ********************************************************
Private Sub SSTab1_Click(PreviousTab As Integer)
Form_Resize
If SSTab1.Tab = TAB_LEFT Then
Text1.Visible = True
Text2.Visible = False
Text3.Visible = False
Me.Caption = WebBrowser1.Document.All.Tags("TITLE")(0).innerText
End If
If SSTab1.Tab = TAB_RIGHT Then
Text1.Visible = False
Text2.Visible = True
Text3.Visible = False
Me.Caption = WebBrowser2.Document.All.Tags("TITLE")(0).innerText
End If
If SSTab1.Tab = TAB_XXX Then
Text1.Visible = False
Text2.Visible = False
Text3.Visible = True
Me.Caption = WebBrowser3.Document.All.Tags("TITLE")(0).innerText
End If
SSTab1.TabCaption(SSTab1.Tab) = Me.Caption
End Sub
' ********************************************************
' Enter ƒL[‚̈—(1)
' ********************************************************
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
WebBrowser1.Navigate2 Text1.Text
End If
End Sub
' ********************************************************
' Enter ƒL[‚̈—(2)
' ********************************************************
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
WebBrowser2.Navigate2 Text2.Text
End If
End Sub
' ********************************************************
' Enter ƒL[‚̈—(3)
' ********************************************************
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
WebBrowser3.Navigate2 Text3.Text
End If
End Sub
' ********************************************************
' ƒy[ƒW•\Ž¦Š®—¹(1)
' ********************************************************
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
SSTab1.TabCaption(0) = WebBrowser1.Document.All.Tags("TITLE")(0).innerText
If SSTab1.Tab = TAB_LEFT Then
Me.Caption = SSTab1.TabCaption(0)
End If
Text1.Text = URL
End Sub
Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
StatusBar1.Panels(1).Text = Text
End Sub
' ********************************************************
' ƒy[ƒW•\Ž¦Š®—¹(2)
' ********************************************************
Private Sub WebBrowser2_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
SSTab1.TabCaption(1) = WebBrowser2.Document.All.Tags("TITLE")(0).innerText
If SSTab1.Tab = TAB_RIGHT Then
Me.Caption = SSTab1.TabCaption(1)
End If
Text2.Text = URL
End Sub
Private Sub WebBrowser2_StatusTextChange(ByVal Text As String)
StatusBar1.Panels(1).Text = Text
End Sub
' ********************************************************
' ƒy[ƒW•\Ž¦Š®—¹(3)
' ********************************************************
Private Sub WebBrowser3_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
SSTab1.TabCaption(2) = WebBrowser3.Document.All.Tags("TITLE")(0).innerText
If SSTab1.Tab = TAB_XXX Then
Me.Caption = SSTab1.TabCaption(2)
End If
Text3.Text = URL
End Sub
Private Sub WebBrowser3_StatusTextChange(ByVal Text As String)
StatusBar1.Panels(1).Text = Text
End Sub
Private Sub ƒIƒvƒVƒ‡ƒ“_Click()
Form3.Show vbModal
End Sub
Private Sub ƒ\[ƒX•\Ž¦_Click()
Form2.Show vbModal
End Sub
Private Sub ƒvƒŒƒrƒ…[_Click()
If SSTab1.Tab = TAB_LEFT Then
WebBrowser1.ExecWB OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT
End If
If SSTab1.Tab = TAB_RIGHT Then
WebBrowser2.ExecWB OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT
End If
If SSTab1.Tab = TAB_XXX Then
WebBrowser3.ExecWB OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT
End If
End Sub
Private Sub –ß‚é_Click()
On Error Resume Next
If SSTab1.Tab = TAB_LEFT Then
WebBrowser1.GoBack
End If
If SSTab1.Tab = TAB_RIGHT Then
WebBrowser2.GoBack
End If
If SSTab1.Tab = TAB_XXX Then
WebBrowser3.GoBack
End If
End Sub
Private Sub i‚Þ_Click()
On Error Resume Next
If SSTab1.Tab = TAB_LEFT Then
WebBrowser1.GoForward
End If
If SSTab1.Tab = TAB_RIGHT Then
WebBrowser2.GoForward
End If
If SSTab1.Tab = TAB_XXX Then
WebBrowser3.GoForward
End If
End Sub
| |