Шаг 48 - OLE+VFP+InternetExplorer

Продолжаем работать с OLE. Давайте автоматизируем InternetExplorer. Самый простой вариант поступить как и в прошлых шагах:

oleApp = CreateObject("InternetExplorer.Application")
oleApp.Visible=.t.
oleApp.Navigate("http://www.firststeps.ru")

Неплохо, но можно лучше. Давайте разместим броузер на своей форме:

oleApp = createobject("MyInternetExplorer")
oleApp.visible = .t.
oleApp.oweb.navigate("www.firststeps.ru")

define class MyInternetExplorer as form
	add object oweb as CWeb
	caption = "Internet Explorer"
	procedure init
		thisform.left = 0
		thisform.width = sysmetric(1) / 2
		thisform.height = sysmetric(2) / 2
		this.resize
	procedure resize
		this.oweb.resize
enddefine

define class CWeb as olecontrol
	oleclass = "Shell.Explorer.1"
	procedure resize
		this.width = thisform.width - 10
		this.height = thisform.height - 10
	procedure refresh
		nodefault
enddefine

Результат:

48_1.gif (13422 b)

Вот и все.


Предыдущий Шаг | Следующий Шаг | Оглавление
Автор Клементьев В.А - 27.08.2002