<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; VBScript: пример обработки событий Internet Explorer]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=996</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=996&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «VBScript: пример обработки событий Internet Explorer».]]></description>
		<lastBuildDate>Tue, 25 Dec 2007 19:59:37 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[VBScript: пример обработки событий Internet Explorer]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=7360#p7360</link>
			<description><![CDATA[<p>Самый простой пример работы с событиями <strong>InternetExplorer.Application</strong>. Так же можно ловить события <strong>Word.Application</strong>, <strong>Excel.Application</strong>, <strong>MSWinsock.Winsock</strong>.<br /></p><div class="codebox"><pre><code>&#039;/// Создаём экземпляр нового класса
Set InternetExplorer = New InternetExplorerClass
&#039;/// Делаем IE видимым
InternetExplorer.Application.Visible = True

&#039;// Описываем события
Sub InternetExplorer_DocumentComplete(pDisp, URL)
    MsgBox &quot;Загрузка &quot; &amp; URL &amp; &quot; завершена.&quot;, vbInformation, &quot;Internet Explorer&quot;
End Sub
Sub InternetExplorer_OnQuit()
    MsgBox &quot;Вы закрыли Internet Explorer&quot;,vbInformation,&quot;Internet Explorer&quot;
    Wscript.Quit
End Sub

&#039;/// Класс модуль InternetExplorer
Class InternetExplorerClass
    Public Application

    Private Sub Class_Initialize
        &#039;/// Вся идея в создании объекта через WScript. Вторым параметром указывается префикс функций-обработчиков событий
        Set Application = WScript.CreateObject(&quot;InternetExplorer.Application&quot;, &quot;InternetExplorer_&quot;)
    End Sub

    Sub Class_Terminate
        &#039;/// Для того, чтобы WScript не завершил выполнение сценария при попытке уничтожить модуль,
        &#039;/// делаем цикл, который завершается, если объект IE перестал существовать.
        On Error Resume Next
        Do
            WScript.Sleep 10
        Loop Until Application = &quot;&quot;
    End Sub
End Class</code></pre></div><p>Автор примера - <strong>Xameleon</strong>.</p>]]></description>
			<author><![CDATA[null@example.com (The gray Cardinal)]]></author>
			<pubDate>Tue, 25 Dec 2007 19:59:37 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=7360#p7360</guid>
		</item>
	</channel>
</rss>
