ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文
【VB.NET】個人が家で使う簡易WEBブラウザの作成
日時: 2008/05/13 01:07
名前: lightbox



land.to のコントロールパネルにログインする為の仕様です。

CustomBrowser.vb
拡張子:
Public Class CustomBrowser

	' *********************************************************
	' ステータスバーの表示用
	' *********************************************************
	Protected Overrides Sub OnStatusTextChanged(ByVal e As System.EventArgs)

		Form1.StatusText.Text = Me.StatusText

		MyBase.OnStatusTextChanged(e)
	End Sub

End Class
CustomBrowser.Designer.vb
拡張子:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class CustomBrowser
	Inherits System.Windows.Forms.WebBrowser

	'UserControl はコンポーネント一覧をクリーンアップするために dispose をオーバーライドします。
	<System.Diagnostics.DebuggerNonUserCode()> _
	Protected Overrides Sub Dispose(ByVal disposing As Boolean)
		If disposing AndAlso components IsNot Nothing Then
			components.Dispose()
		End If
		MyBase.Dispose(disposing)
	End Sub

	'Windows フォーム デザイナで必要です。
	Private components As System.ComponentModel.IContainer

	'メモ: 以下のプロシージャは Windows フォーム デザイナで必要です。
	'Windows フォーム デザイナを使用して変更できます。  
	'コード エディタを使って変更しないでください。
	<System.Diagnostics.DebuggerStepThrough()> _
	Private Sub InitializeComponent()
		components = New System.ComponentModel.Container()
	End Sub

End Class

Form1.vb
拡張子:
Public Class Form1

	' *********************************************************
	' 初期処理
	' *********************************************************
	Private Sub Form1_Load(ByVal sender As System.Object, _
	ByVal e As System.EventArgs) Handles MyBase.Load

		' FORM を最大化
		Me.WindowState = FormWindowState.Maximized
		' FORM を最大化
		Me.CustomBrowser.Navigate("https://secure.land.to/co.php")

	End Sub

	' *********************************************************
	' ページが表示された直後
	' *********************************************************
	Private Sub CustomBrowser_DocumentCompleted(ByVal sender As System.Object, _
	ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) _
	Handles CustomBrowser.DocumentCompleted

		Me.CustomBrowser.Document.All("co_id").SetAttribute("value", "ユーザー名")
		'正しいユーザー・パスワードをセットして、submit のコメントを外すと
		'ページが表示されたらすぐにログオンします
		'通常、exe内な文字列はテキストで保存されているので、実際のパスワードを書くのは避けたほうが良いでしょう
		Me.CustomBrowser.Document.All("co_pass").SetAttribute("value", "パスワード")
		' この項目はコンボボックスです
		Me.CustomBrowser.Document.All("co_serv").SetAttribute("value", "00000013")
		'以下 submit
		'Me.CustomBrowser.Document.GetElementsByTagName("FORM")(0).InvokeMember("submit")

	End Sub
End Class
Form1.Designer.vb
拡張子:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'フォームがコンポーネントの一覧をクリーンアップするために dispose をオーバーライドします。
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows フォーム デザイナで必要です。
    Private components As System.ComponentModel.IContainer

    'メモ: 以下のプロシージャは Windows フォーム デザイナで必要です。
    'Windows フォーム デザイナを使用して変更できます。  
    'コード エディタを使って変更しないでください。
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
		Me.CustomBrowser = New CUSTOM_BROWSER.CustomBrowser
		Me.StatusBar = New System.Windows.Forms.StatusStrip
		Me.StatusText = New System.Windows.Forms.ToolStripStatusLabel
		Me.StatusBar.SuspendLayout()
		Me.SuspendLayout()
		'
		'CustomBrowser
		'
		Me.CustomBrowser.Dock = System.Windows.Forms.DockStyle.Fill
		Me.CustomBrowser.Location = New System.Drawing.Point(0, 0)
		Me.CustomBrowser.MinimumSize = New System.Drawing.Size(20, 20)
		Me.CustomBrowser.Name = "CustomBrowser"
		Me.CustomBrowser.Size = New System.Drawing.Size(818, 498)
		Me.CustomBrowser.TabIndex = 0
		'
		'StatusBar
		'
		Me.StatusBar.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.StatusText})
		Me.StatusBar.Location = New System.Drawing.Point(0, 476)
		Me.StatusBar.Name = "StatusBar"
		Me.StatusBar.Size = New System.Drawing.Size(818, 22)
		Me.StatusBar.TabIndex = 1
		'
		'StatusText
		'
		Me.StatusText.Name = "StatusText"
		Me.StatusText.Size = New System.Drawing.Size(117, 17)
		Me.StatusText.Text = "ToolStripStatusLabel1"
		'
		'Form1
		'
		Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
		Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
		Me.ClientSize = New System.Drawing.Size(818, 498)
		Me.Controls.Add(Me.StatusBar)
		Me.Controls.Add(Me.CustomBrowser)
		Me.Name = "Form1"
		Me.Text = "Form1"
		Me.StatusBar.ResumeLayout(False)
		Me.StatusBar.PerformLayout()
		Me.ResumeLayout(False)
		Me.PerformLayout()

	End Sub
	Friend WithEvents CustomBrowser As CUSTOM_BROWSER.CustomBrowser
	Friend WithEvents StatusBar As System.Windows.Forms.StatusStrip
	Friend WithEvents StatusText As System.Windows.Forms.ToolStripStatusLabel

End Class
メンテナンス


日時: 2008/05/13 01:07
名前: lightbox