1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

vbsの作法 その90

Last updated at Posted at 2024-10-14

概要

vbsの作法、調べてみた。
vbs見つけたので、やってみた。

参考にしたページ

サンプルコード

Class window_class
	Private objIE
	Private namae
	Private hyoujibun
	Private tate, iro, moji
	Private Sub Class_Initialize
		namae = "窓1"
		iro = "lightgreen"
		Set objIE = CreateObject("InternetExplorer.Application")
		objIE.Visible = true
		objIE.Top = 50
		objIE.Left = 100
		objIE.Width = 300
		objIE.Height = 200
		objIE.Navigate("about:blank")
		objIE.StatusBar = False
		objIE.ToolBar = 0
		objIE.Document.Write("<html><head><title>ウインドウ オブジェクト " & namae & "</title></head>")
		objIE.Document.Write("<body bgcolor='" & iro & "'>")
		objIE.Document.Write("<div id='div-id-1'></div><br>")
		objIE.Document.Write("<div id='div-id-2'></div><br>")
		objIE.Document.Write("<div id='div-id-3'></div><br>")
		objIE.Document.Write("</body></html>")
	End Sub
	Private Sub Class_Terminate
		MsgBox "ウインドウオブジェクト " & namae & " 解放", vbOKOnly + vbInformation, "ウインドウオブジェクト インスタンス " & namae
	End Sub
	Public Sub set_namae(meisyou)
		namae = meisyou
	End Sub
	Public Function get_namae()
		get_namae = namae
	End Function
	Public Sub moji_hyouji(moji)
		objIE.Document.getElementById("div-id-1").InnerText = moji
	End Sub
	Public Sub idou(x, y)
		objIE.Left = x
		objIE.Top = y
	End Sub
	Public Sub henkei(w, h)
		objIE.Width = w
		objIE.Height = h
	End Sub
	Public Sub ironuri(iro)
		objIE.Document.bgColor = iro
	End Sub
	Public Sub jyouhou_hyouji()
		MsgBox "ウインドウオブジェクト " & namae & " サイズ ", vbOKOnly + vbInformation, namae & " ウインドウ 情報"
	End Sub
	Public Sub tojiru()
		objIE.Quit
	End Sub
End Class


Dim w1
Set w1 = new window_class
w1.set_namae("ウインドウ1")
w1.henkei 400, 400
w1.idou 10, 10
w1.moji_hyouji "草原"
w1.ironuri("white")
w1.jyouhou_hyouji()
msgbox "文字を変更"
w1.moji_hyouji "さかな"
msgbox "ウインドウを閉じます。"
w1.tojiru()
Set w1 = Nothing





以上

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?