Public WithEvents IE As InternetExplorer - VB

Узнай цену своей работы

Формулировка задачи:

Добрый день...
кто работал с этой бибидиотекой как её подключить?

Решение задачи: «Public WithEvents IE As InternetExplorer»

textual
Листинг программы
<font size="2"><font color="blue">Private</font> <font color="blue">WithEvents</font> winShell <font color="blue">As</font> SHDocVw.ShellWindows<br><font color="blue">Private</font> mCol <font color="blue">As</font> Collection<br><font color="blue">Dim</font> bRefreshing <font color="blue">As</font> <font color="blue">Boolean</font><br><br><font color="blue">Public</font> <font color="blue">Event</font> IEWindowRegistered()<br><font color="blue">Public</font> <font color="blue">Event</font> IEWindowRevoked()<br><font color="blue">Public</font> <font color="blue">Event</font> IENavigationBegin(hwnd <font color="blue">As</font> Long, <font color="blue">ByVal</font> pDisp <font color="blue">As</font> Object, URL <font color="blue">As</font> Variant, Flags <font color="blue">As</font> Variant, TargetFrameName <font color="blue">As</font> Variant, PostData <font color="blue">As</font> Variant, Headers <font color="blue">As</font> Variant, Cancel <font color="blue">As</font> <font color="blue">Boolean</font>)<br><font color="blue">Public</font> <font color="blue">Event</font> IENavigationComplete(hwnd <font color="blue">As</font> Long, <font color="blue">ByVal</font> pDisp <font color="blue">As</font> Object, URL <font color="blue">As</font> <font color="blue">Variant</font>)<br><font color="blue">Public</font> <font color="blue">Event</font> IEDocumentComplete(hwnd <font color="blue">As</font> Long, <font color="blue">ByVal</font> pDisp <font color="blue">As</font> Object, URL <font color="blue">As</font> <font color="blue">Variant</font>)<br><font color="blue">Public</font> <font color="blue">Event</font> IEDownloadBegin(hwnd <font color="blue">As</font> <font color="blue">Long</font>)<br><font color="blue">Public</font> <font color="blue">Event</font> IEDownloadComplete(hwnd <font color="blue">As</font> <font color="blue">Long</font>)<br><font color="blue">Public</font> <font color="blue">Event</font> IEOnContextMenu(hwnd <font color="blue">As</font> <font color="blue">Long</font>)<br><font color="blue">Public</font> <font color="blue">Event</font> IEMouseDown(hwnd <font color="blue">As</font> Long, Button <font color="blue">As</font> Long, Shift <font color="blue">As</font> Long, X <font color="blue">As</font> Single, Y <font color="blue">As</font> <font color="blue">Single</font>)<br><font color="blue">Public</font> <font color="blue">Event</font> IEMouseUp(hwnd <font color="blue">As</font> Long, Button <font color="blue">As</font> Long, Shift <font color="blue">As</font> Long, X <font color="blue">As</font> Single, Y <font color="blue">As</font> <font color="blue">Single</font>)<br><font color="blue">Public</font> <font color="blue">Event</font> IECommandStateChange(hwnd <font color="blue">As</font> Long, Button <font color="blue">As</font> CommandStateChangeConstants, Enable <font color="blue">As</font> <font color="blue">Boolean</font>)<br><br><font color="blue">Private</font> <font color="blue">Function</font> Add(IEctl <font color="blue">As</font> SHDocVw.InternetExplorer) <font color="blue">As</font> IE_Class<br><font color="blue">Dim</font> objNewMember <font color="blue">As</font> IE_Class<br>    <font color="blue">Set</font> objNewMember = <font color="blue">New</font> IE_Class<br>    <font color="blue">Set</font> objNewMember.IEctl = IEctl<br>    mCol.Add objNewMember <font color="green">', h & objNewMember.IEHandle</font><br>    <font color="blue">Set</font> Add = objNewMember<br>    <font color="blue">Set</font> objNewMember = <font color="blue">Nothing</font><br><font color="blue">End</font> <font color="blue">Function</font><br><br><font color="blue">Public</font> <font color="blue">Property</font> <font color="blue">Get</font> IE(vntIndexKey <font color="blue">As</font> <font color="blue">Variant</font>) <font color="blue">As</font> IE_Class<br>  <font color="blue">Do</font> <font color="blue">While</font> bRefreshing<br>     <font color="blue">DoEvents</font><br>  <font color="blue">Loop</font><br>  <font color="blue">Set</font> IE = mCol(vntIndexKey)<br><font color="blue">End</font> <font color="blue">Property</font><br><br><font color="blue">Public</font> <font color="blue">Property</font> <font color="blue">Get</font> Count() <font color="blue">As</font> <font color="blue">Long</font><br>   Count = mCol.Count<br><font color="blue">End</font> <font color="blue">Property</font><br><br><font color="blue">Private</font> <font color="blue">Sub</font> Remove(vntIndexKey <font color="blue">As</font> <font color="blue">Variant</font>)<br>   mCol.Remove vntIndexKey<br><font color="blue">End</font> <font color="blue">Sub</font><br><br><font color="blue">Public</font> <font color="blue">Property</font> <font color="blue">Get</font> NewEnum() <font color="blue">As</font> IUnknown<br>   <font color="blue">Set</font> NewEnum = mCol.[_NewEnum]<br><font color="blue">End</font> <font color="blue">Property</font><br><br><font color="blue">Private</font> <font color="blue">Sub</font> Class_Initialize()<br>  cIEWPtr = ObjPtr(<font color="blue">Me</font>)<br>  Refresh_Col<br><font color="blue">End</font> <font color="blue">Sub</font><br><br><font color="blue">Private</font> <font color="blue">Sub</font> Class_Terminate()<br>   <font color="blue">Set</font> mCol = <font color="blue">Nothing</font><br>   <font color="blue">Set</font> winShell = <font color="blue">Nothing</font><br><font color="blue">End</font> <font color="blue">Sub</font><br><br><font color="blue">Private</font> <font color="blue">Sub</font> winShell_WindowRegistered(<font color="blue">ByVal</font> lCookie <font color="blue">As</font> <font color="blue">Long</font>)<br>  Refresh_Col<br>  <font color="blue">Do</font> <font color="blue">While</font> bRefreshing<br>     <font color="blue">DoEvents</font><br>  <font color="blue">Loop</font><br>  <font color="blue">RaiseEvent</font> IEWindowRegistered<br><font color="blue">End</font> <font color="blue">Sub</font><br><br><font color="blue">Private</font> <font color="blue">Sub</font> winShell_WindowRevoked(<font color="blue">ByVal</font> lCookie <font color="blue">As</font> <font color="blue">Long</font>)<br>  Refresh_Col<br>  <font color="blue">Do</font> <font color="blue">While</font> bRefreshing<br>     <font color="blue">DoEvents</font><br>  <font color="blue">Loop</font><br>  <font color="blue">RaiseEvent</font> IEWindowRevoked<br><font color="blue">End</font> <font color="blue">Sub</font><br><br><font color="blue">Public</font> <font color="blue">Sub</font> Refresh_Col()<br><font color="blue">Dim</font> SWs <font color="blue">As</font> <font color="blue">New</font> SHDocVw.ShellWindows<br><font color="blue">Dim</font> var <font color="blue">As</font> SHDocVw.InternetExplorer<br>   bRefreshing = <font color="blue">True</font><br>   <font color="blue">Set</font> mCol = <font color="blue">Nothing</font><br>   <font color="blue">Set</font> mCol = <font color="blue">New</font> Collection<br>   <font color="blue">For</font> <font color="blue">Each</font> var <font color="blue">In</font> SWs<br>       Add var<br>   <font color="blue">Next</font><br>   <font color="blue">Set</font> winShell = SWs<br>   <font color="blue">Set</font> SWs = <font color="blue">Nothing</font><br>   <font color="blue">Set</font> var = <font color="blue">Nothing</font><br>   bRefreshing = <font color="blue">False</font><br><font color="blue">End</font> <font color="blue">Sub</font><br><br><font color="blue">Friend</font> <font color="blue">Function</font> FireEvent(nEvent <font color="blue">As</font> IDEVENTS, hwnd <font color="blue">As</font> Long, <font color="blue">ParamArray</font> EventInfo())<br>   <font color="blue">Select</font> <font color="blue">Case</font> nEvent<br>          <font color="blue">Case</font> ID_BeforeNavigate<br>               <font color="blue">RaiseEvent</font> IENavigationBegin(hwnd, EventInfo(0), EventInfo(1), EventInfo(2), EventInfo(3), EventInfo(4), EventInfo(5), <font color="blue">CBool</font>(EventInfo(6)))<br>          <font color="blue">Case</font> ID_NavigationComplete<br>               <font color="blue">RaiseEvent</font> IENavigationComplete(hwnd, EventInfo(0), EventInfo(1))<br>          <font color="blue">Case</font> ID_DocumentComplete<br>               <font color="blue">RaiseEvent</font> IEDocumentComplete(hwnd, EventInfo(0), EventInfo(1))<br>          <font color="blue">Case</font> ID_DownloadBegin<br>               <font color="blue">RaiseEvent</font> IEDownloadBegin(hwnd)<br>          <font color="blue">Case</font> ID_DownloadComplete<br>               <font color="blue">RaiseEvent</font> IEDownloadComplete(hwnd)<br>          <font color="blue">Case</font> ID_ContextMenu<br>               <font color="blue">RaiseEvent</font> IEOnContextMenu(hwnd)<br>          <font color="blue">Case</font> ID_MouseDown<br>               <font color="blue">RaiseEvent</font> IEMouseDown(hwnd, <font color="blue">CInt</font>(EventInfo(0)), <font color="blue">CInt</font>(EventInfo(1)), <font color="blue">CSng</font>(EventInfo(2)), <font color="blue">CSng</font>(EventInfo(3)))<br>          <font color="blue">Case</font> ID_MouseUp<br>               <font color="blue">RaiseEvent</font> IEMouseUp(hwnd, <font color="blue">CInt</font>(EventInfo(0)), <font color="blue">CInt</font>(EventInfo(1)), <font color="blue">CSng</font>(EventInfo(2)), <font color="blue">CSng</font>(EventInfo(3)))<br>          <font color="blue">Case</font> ID_CommandStateChange<br>               <font color="blue">RaiseEvent</font> IECommandStateChange(hwnd, <font color="blue">CLng</font>(EventInfo(0)), <font color="blue">CBool</font>(EventInfo(1)))<br>   <font color="blue">End</font> <font color="blue">Select</font><br><font color="blue">End</font> Function</font>

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

8   голосов , оценка 4.25 из 5