'CYTOLOGY2 Yahooニューストピックス一括表示 20130126 '--------------------------------------------------------------- Imports System.Drawing Imports System.Windows.Forms Public Class AddIn Private Const APPNAME As String = "Yahooニューストピックス一括表示" Private tabb As TabBrowser Private std As Std Private ddLabelNow As ToolStripLabel Public Sub New() tabb = New TabBrowser() std = New Std() End Sub Public Sub AddIn_Load() startMessage() End Sub Public Sub AddIn_Stop() std.AddInMenuRemove() End Sub Public Sub AddIn_Start() ddButtonInitial01() demo1() End Sub Private Sub info(ByVal str As String, ByVal c As Color) If std.StopFlag Then Exit Sub ddLabelNow.Text = str ddLabelNow.ForeColor = c Application.DoEvents() End Sub Private Sub ddButtonInitial01() ddLabelNow = New ToolStripLabel("停止中") ddLabelNow.ForeColor = Color.Black std.AddInMenuAddOnce(ddLabelNow) End Sub Private Sub startMessage() tabb.TabText = APPNAME Dim str As String = "" str &= "" & APPNAME & "" str &= "" str &= "

" & APPNAME & "

" str &= "このデモンストレーションは、以下の動作をします
" str &= "1.Yahooトップページ表示
" str &= "2.ニュースのトピックス8件を取得
" str &= "3.8件を新規タブで開く
" str &= "4.アドインプログラムの実行を停止します
" str &= "
" str &= "実行ボタンで開始します" str &= "" tabb.WebBrowser.DocumentText = str End Sub Private Sub demo1() tabb.Navigate("http://yahoo.co.jp/") tabb.DocumentCompletedEventAdd(AddressOf demo2) End Sub Private Sub demo2(ByVal sender As Object, ByVal e As System.EventArgs) tabb.DocumentCompletedEventRemove(AddressOf demo2) Dim elems As HtmlElementCollection = tabb.WebBrowser.Document.GetElementById("topicsfb").All Dim c As Integer = 0 For Each elm As HtmlElement In elems If elm.OuterHtml.StartsWith("= 8 Then Exit For End If End If Next std.ExitAddIn() End Sub End Class