Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Web based GUI example

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Web based GUI example

    The code below provides wrappers and classes to allow to make a web based gui. the example embeds an instance of the WebBrowser control in a PBWIN application, creates a web page on the fly and connects to the events fired by the WebBrowser control and the web page loaded in it.

    You can find the wrappers to embed the WebBrowser control (IEWB2.INC) at: http://www.powerbasic.com/support/pbforums/showthread.php?t=24548

    If you have any comments, you can post them in this thread: http://www.powerbasic.com/support/pbforums/showthread.php?t=12410
    Last edited by José Roca; 30 Aug 2007, 06:51 PM.
    Forum: http://www.jose.it-berater.org/smfforum/index.php

  • #2
    Save it as IHTMLEventObj.inc
    Code:
    ' ****************************************************************************************
    ' Interface name = IHTMLEventObj
    ' IID = {3050F32D-98B5-11CF-BB82-00AA00BDCE0B}
    ' Attributes = 4160 [&H1040] [Dual] [Dispatchable]
    ' Implied interface = IDispatch
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' This interface provides access to the event processes, such as the element in which the
    ' event occurred, the state of the keyboard keys, the location of the mouse, and the state
    ' of the mouse buttons.
    ' The event object is only available during an event; that is, you can use it in event
    ' handlers but not in other code.
    ' Although all event properties are available to all event objects, some properties might
    ' not have meaningful values during some events. For example, the values retrieved by the
    ' IHTMLEventObj::fromElement and the IHTMLEventObj::toElement methods are meaningful only
    ' when processing the onmouseover and onmouseout events.
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]srcElement property
    ' Retrieves the object that fired the event.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_srcElement (BYVAL pthis AS DWORD PTR, BYREF p AS DWORD) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_srcElement (BYVAL pthis AS DWORD PTR) AS DWORD
        LOCAL p AS DWORD
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[7] USING Proto_IHTMLEventObj_get_srcElement(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]altKey property
    ' Retrieves a value that indicates the state of the ALT key.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_altKey (BYVAL pthis AS DWORD PTR, BYREF p AS INTEGER) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_altKey (BYVAL pthis AS DWORD PTR) AS INTEGER
        LOCAL p AS INTEGER
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[8] USING Proto_IHTMLEventObj_get_altKey(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]ctrlKey property
    ' Retrieves the state of the CTRL key.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_ctrlKey (BYVAL pthis AS DWORD PTR, BYREF p AS INTEGER) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_ctrlKey (BYVAL pthis AS DWORD PTR) AS INTEGER
        LOCAL p AS INTEGER
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[9] USING Proto_IHTMLEventObj_get_ctrlKey(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]shiftKey property
    ' Retrieves the state of the SHIFT key.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_shiftKey (BYVAL pthis AS DWORD PTR, BYREF p AS INTEGER) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_shiftKey (BYVAL pthis AS DWORD PTR) AS INTEGER
        LOCAL p AS INTEGER
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[10] USING Proto_IHTMLEventObj_get_shiftKey(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [put_]returnValue property
    ' Sets the return value from the event.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_put_returnValue (BYVAL pthis AS DWORD PTR, BYVAL p AS VARIANT) AS LONG
    ' ****************************************************************************************
    SUB IHTMLEventObj_put_returnValue (BYVAL pthis AS DWORD PTR, BYVAL p AS VARIANT)
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
        CALL DWORD @@pthis[11] USING Proto_IHTMLEventObj_put_returnValue(pthis, p) TO HtmlResult
    END SUB
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]returnValue property
    ' Retrieves the return value from the event.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_returnValue (BYVAL pthis AS DWORD PTR, BYREF p AS VARIANT) AS LONG
    ' ****************************************************************************************
    SUB IHTMLEventObj_get_returnValue (BYVAL pthis AS DWORD PTR, BYREF p AS VARIANT)
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
        CALL DWORD @@pthis[12] USING Proto_IHTMLEventObj_get_returnValue(pthis, p) TO HtmlResult
    END SUB
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [put_]cancelBubble property
    ' Sets whether the current event should bubble up the hierarchy of event handlers.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_put_cancelBubble (BYVAL pthis AS DWORD PTR, BYVAL p AS INTEGER) AS LONG
    ' ****************************************************************************************
    SUB IHTMLEventObj_put_cancelBubble (BYVAL pthis AS DWORD PTR, BYVAL p AS INTEGER)
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
        CALL DWORD @@pthis[13] USING Proto_IHTMLEventObj_put_cancelBubble(pthis, p) TO HtmlResult
    END SUB
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]cancelBubble property
    ' Retrieves whether the current event should bubble up the hierarchy of event handlers.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_cancelBubble (BYVAL pthis AS DWORD PTR, BYREF p AS INTEGER) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_cancelBubble (BYVAL pthis AS DWORD PTR) AS INTEGER
        LOCAL p AS INTEGER
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[14] USING Proto_IHTMLEventObj_get_cancelBubble(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]fromElement property
    ' Retrieves the object from which activation or the mouse pointer is exiting during the event.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_fromElement (BYVAL pthis AS DWORD PTR, BYREF p AS DWORD) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_fromElement (BYVAL pthis AS DWORD PTR) AS DWORD
        LOCAL p AS DWORD
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[15] USING Proto_IHTMLEventObj_get_fromElement(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]toElement property
    ' Retrieves a reference to the object toward which the user is moving the mouse pointer.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_toElement (BYVAL pthis AS DWORD PTR, BYREF p AS DWORD) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_toElement (BYVAL pthis AS DWORD PTR) AS DWORD
        LOCAL p AS DWORD
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[16] USING Proto_IHTMLEventObj_get_toElement(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [put_]keyCode property
    ' Sets the Unicode key code associated with the key that caused the event.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_put_keyCode (BYVAL pthis AS DWORD PTR, BYVAL p AS LONG) AS LONG
    ' ****************************************************************************************
    SUB IHTMLEventObj_put_keyCode (BYVAL pthis AS DWORD PTR, BYVAL p AS LONG)
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
        CALL DWORD @@pthis[17] USING Proto_IHTMLEventObj_put_keyCode(pthis, p) TO HtmlResult
    END SUB
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]keyCode property
    ' Retrieves the Unicode key code associated with the key that caused the event.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_keyCode (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_keyCode (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[18] USING Proto_IHTMLEventObj_get_keyCode(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]button property
    ' Retrieves the mouse button pressed by the user.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_button (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_button (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[19] USING Proto_IHTMLEventObj_get_button(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]type property
    ' Sets or retrieves the event name from the event object.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_type (BYVAL pthis AS DWORD PTR, BYREF p AS STRING) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_type (BYVAL pthis AS DWORD PTR) AS STRING
        LOCAL p AS STRING
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[20] USING Proto_IHTMLEventObj_get_type(pthis, p) TO HtmlResult
        FUNCTION = ACODE$(p)
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]qualifier property
    ' Retrieves the name of the data member provided by a data source object.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_qualifier (BYVAL pthis AS DWORD PTR, BYREF p AS STRING) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_qualifier (BYVAL pthis AS DWORD PTR) AS STRING
        LOCAL p AS STRING
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[21] USING Proto_IHTMLEventObj_get_qualifier(pthis, p) TO HtmlResult
        FUNCTION = ACODE$(p)
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]reason property
    ' Retrieves the result of the data transfer for a data source object.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_reason (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_reason (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[22] USING Proto_IHTMLEventObj_get_reason(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]x property
    ' Retrieves the x-coordinate, in pixels, of the mouse pointer's position relative to a
    ' relatively positioned parent element.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_x (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_x (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[23] USING Proto_IHTMLEventObj_get_x(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]y property
    ' Retrieves the y-coordinate, in pixels, of the mouse pointer's position relative to a
    ' relatively positioned parent element.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_y (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_y (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[24] USING Proto_IHTMLEventObj_get_y(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]clientX property
    ' Retrieves the x-coordinate of the mouse pointer's position relative to the client area
    ' of the window, excluding window decorations and scroll bars.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_clientX (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_clientX (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[25] USING Proto_IHTMLEventObj_get_clientX(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]clientY property
    ' Retrieves the y-coordinate of the mouse pointer's position relative to the client area
    ' of the window, excluding window decorations and scroll bars.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_clientY (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_clientY (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[26] USING Proto_IHTMLEventObj_get_clientY(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]offsetX property
    ' Retrieves the x-coordinate of the mouse pointer's position relative to the object
    ' firing the event.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_offsetX (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_offsetX (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[27] USING Proto_IHTMLEventObj_get_offsetX(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]offsetY property
    ' Retrieves the y-coordinate of the mouse pointer's position relative to the object
    ' firing the event.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_offsetY (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_offsetY (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[28] USING Proto_IHTMLEventObj_get_offsetY(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]screenX property
    ' Retrieves the x-coordinate of the mouse pointer's position relative to the user's screen.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_screenX (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_screenX (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[29] USING Proto_IHTMLEventObj_get_screenX(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]screenY property
    ' Retrieves the y-coordinate of the mouse pointer's position relative to the user's screen.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_screenY (BYVAL pthis AS DWORD PTR, BYREF p AS LONG) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_screenY (BYVAL pthis AS DWORD PTR) AS LONG
        LOCAL p AS LONG
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[30] USING Proto_IHTMLEventObj_get_screenY(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' [get_]srcFilter property
    ' Retrieves the filter object that caused the onfilterchange event to fire.
    ' ****************************************************************************************
    DECLARE FUNCTION Proto_IHTMLEventObj_get_srcFilter (BYVAL pthis AS DWORD PTR, BYREF p AS DWORD) AS LONG
    ' ****************************************************************************************
    FUNCTION IHTMLEventObj_get_srcFilter (BYVAL pthis AS DWORD PTR) AS DWORD
        LOCAL p AS DWORD
        IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
        CALL DWORD @@pthis[31] USING Proto_IHTMLEventObj_get_srcFilter(pthis, p) TO HtmlResult
        FUNCTION = p
    END FUNCTION
    ' ****************************************************************************************

    ------------------
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      Save it as HTMLDocumentEvents2.inc
      Code:
      ' ****************************************************************************************
      ' HTMLDocumentEvents2 dispatch interface
      ' This dispinterface provides a connection point so that an application or control can
      ' intercept events fired by a document object.
      ' IID = {3050F613-98B5-11CF-BB82-00AA00BDCE0B}
      ' Attributes = 4112 [&H1010]  [Hidden] [Dispatchable]
      ' Number of functions = 38
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' EXCEPINFO structure
      ' ****************************************************************************************
      TYPE HTMLDocumentEvents2_EXCEPINFO
         wCode AS WORD               ' An error code describing the error.
         wReserved AS WORD           ' Reserved
         bstrSource AS DWORD         ' Source of the exception.
         bstrDescription AS DWORD    ' Textual description of the error.
         bstrHelpFile AS DWORD       ' Help file path.
         dwHelpContext AS DWORD      ' Help context ID.
         pvReserved AS DWORD         ' Reserved.
         pfnDeferredFillIn AS DWORD  ' Pointer to function that fills in Help and description info.
         scode AS DWORD              ' An error code describing the error.
      END TYPE
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Returns a pointer to a specified interface on an object to which a client currently holds an
      ' interface pointer.
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_IUnknown_QueryInterface (BYVAL pthis AS DWORD PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
         LOCAL HRESULT AS LONG
         CALL DWORD @@pthis[0] USING HTMLDocumentEvents2_IUnknown_QueryInterface(pthis, riid, ppvObj) TO HRESULT
         FUNCTION = HRESULT
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Decrements the reference count for the calling interface on a object. If the reference count
      ' on the object falls to 0, the object is freed from memory.
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_IUnknown_Release (BYVAL pthis AS DWORD PTR) AS DWORD
         LOCAL DWRESULT AS DWORD
         CALL DWORD @@pthis[2] USING HTMLDocumentEvents2_IUnknown_Release(pthis) TO DWRESULT
         FUNCTION = DWRESULT
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' IConnectionPointContainer::FindConnectionPoint
      ' Returns a pointer to the IConnectionPoint interface of a connection point for a specified IID,
      ' if that IID describes a supported outgoing interface.
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_IConnectionPointContainer_FindConnectionPoint (BYVAL pthis AS DWORD PTR, BYREF riid AS GUID, BYREF ppCP AS DWORD) AS LONG
         LOCAL HRESULT AS LONG
         CALL DWORD @@pthis[4] USING HTMLDocumentEvents2_IConnectionPointContainer_FindConnectionPoint(pthis, riid, ppCP) TO HRESULT
         FUNCTION = HRESULT
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' IConnectionPoint::Advise
      ' Establishes a connection between the connection point object and the client's sink.
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_IConnectionPoint_Advise (BYVAL pthis AS DWORD PTR, _
         BYVAL pUnkSink AS DWORD, BYREF pdwCookie AS DWORD) AS LONG
         LOCAL HRESULT AS LONG
         CALL DWORD @@pthis[5] USING HTMLDocumentEvents2_IConnectionPoint_Advise(pthis, pUnkSink, pdwCookie) TO HRESULT
         FUNCTION = HRESULT
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' IConnectionPoint::Unadvise
      ' Terminates an advisory connection previously established through IConnectionPoint_Advise.
      ' The dwCookie parameter identifies the connection to terminate.
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_IConnectionPoint_Unadvise (BYVAL pthis AS DWORD PTR, BYVAL dwCookie AS DWORD) AS LONG
         LOCAL HRESULT AS LONG
         CALL DWORD @@pthis[6] USING HTMLDocumentEvents2_IConnectionPoint_Unadvise(pthis, dwCookie) TO HRESULT
         FUNCTION = HRESULT
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' IDispatch virtual table
      ' ****************************************************************************************
      TYPE HTMLDocumentEvents2_IDispatchVtbl
         QueryInterface AS DWORD     ' Returns pointers to supported interfaces
         AddRef AS DWORD             ' Increments reference count
         Release AS DWORD            ' Decrements reference count
         GetTypeInfoCount AS DWORD   ' Retrieves the number of type descriptions
         GetTypeInfo AS DWORD        ' Retrieves a description of object's programmable interface
         GetIDsOfNames AS DWORD      ' Maps name of method or property to DispId
         Invoke AS DWORD             ' Calls one of the object's methods, or gets/sets one of its properties
         pVtblAddr AS DWORD          ' Address of the virtual table
         cRef AS DWORD               ' Reference counter
         pthis AS DWORD              ' IUnknown or IDispatch of the control that fires the events
      END TYPE
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' UI4 AddRef()
      ' Increments the reference counter.
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_AddRef (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR) AS DWORD
         INCR @@pCookie.cRef
         FUNCTION = @@pCookie.cRef
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' HRESULT QueryInterface([in] *GUID riid, [out] **VOID ppvObj)
      ' Returns the IUnknown of our class and increments the reference counter.
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_QueryInterface (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, _
         BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
         ppvObj = pCookie
         HTMLDocumentEvents2_AddRef pCookie
         FUNCTION = %S_OK
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' UI4 Release()
      ' Releases our class if there is only a reference to him and decrements the reference counter.
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_Release (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR) AS DWORD
         LOCAL pVtblAddr AS DWORD
         IF @@pCookie.cRef = 1 THEN
            pVtblAddr = @@pCookie.pVtblAddr
            IF ISFALSE HeapFree(GetProcessHeap(), 0, BYVAL pVtblAddr) THEN
               FUNCTION = @@pCookie.cRef
               EXIT FUNCTION
            END IF
         END IF
         DECR @@pCookie.cRef
         FUNCTION = @@pCookie.cRef
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' HRESULT GetTypeInfoCount([out] *UINT pctinfo)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_GetTypeInfoCount (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pctInfo AS DWORD) AS LONG
         FUNCTION = %E_NOTIMPL
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' HRESULT GetTypeInfo([in] UINT itinfo, [in] UI4 lcid, [out] **VOID pptinfo)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_GetTypeInfo (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, _
         BYVAL itinfo AS DWORD, BYVAL lcid AS DWORD, BYREF pptinfo AS DWORD) AS LONG
         FUNCTION = %E_NOTIMPL
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' HRESULT GetIDsOfNames([in] *GUID riid, [in] **I1 rgszNames, [in] UINT cNames, [in] UI4 lcid, [out] *I4 rgdispid)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_GetIDsOfNames ( BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, _
         BYREF riid AS GUID, BYVAL rgszNames AS DWORD, BYVAL cNames AS DWORD, BYVAL lcid AS DWORD, BYREF rgdispid AS LONG) AS LONG
         FUNCTION = %E_NOTIMPL
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Builds the IDispatch Virtual Table
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_BuildVtbl (BYVAL pthis AS DWORD) AS DWORD
      
         LOCAL pVtbl AS HTMLDocumentEvents2_IDispatchVtbl PTR
         LOCAL pUnk AS HTMLDocumentEvents2_IDispatchVtbl PTR
      
         pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
         IF pVtbl = 0 THEN EXIT FUNCTION
      
         @pVtbl.QueryInterface   = CODEPTR(HTMLDocumentEvents2_QueryInterface)
         @pVtbl.AddRef           = CODEPTR(HTMLDocumentEvents2_AddRef)
         @pVtbl.Release          = CODEPTR(HTMLDocumentEvents2_Release)
         @pVtbl.GetTypeInfoCount = CODEPTR(HTMLDocumentEvents2_GetTypeInfoCount)
         @pVtbl.GetTypeInfo      = CODEPTR(HTMLDocumentEvents2_GetTypeInfo)
         @pVtbl.GetIDsOfNames    = CODEPTR(HTMLDocumentEvents2_GetIDsOfNames)
         @pVtbl.Invoke           = CODEPTR(HTMLDocumentEvents2_Invoke)
         @pVtbl.pVtblAddr        = pVtbl
         @pVtbl.pthis            = pthis
      
         pUnk = VARPTR(@pVtbl.pVtblAddr)
         FUNCTION = pUnk
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Establishes a connection between the connection point object and the client's sink.
      ' Returns a token that uniquely identifies this connection.
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_ConnectEvents (BYVAL pthis AS DWORD, BYREF pdwCookie AS DWORD) AS LONG
      
         LOCAL HRESULT AS LONG                 ' HRESULT code
         LOCAL pCPC AS DWORD                   ' IConnectionPointContainer
         LOCAL pCP AS DWORD                    ' IConnectionPoint
         LOCAL IID_CPC AS GUID                 ' IID_IConnectionPointContainer
         LOCAL IID_CP AS GUID                  ' Events dispinterface
         LOCAL dwCookie AS DWORD               ' Returned token
         LOCAL pUnkSink AS DWORD               ' IUnknown of the class
      
         IID_CPC = GUID$("{B196B284-BAB4-101A-B69C-00AA00341D07}")
         IID_CP  = GUID$("{3050F613-98B5-11CF-BB82-00AA00BDCE0B}")
      
         IF pthis = 0 THEN FUNCTION = -1 : EXIT FUNCTION
         HRESULT = HTMLDocumentEvents2_IUnknown_QueryInterface(pthis, IID_CPC, pCPC)
         IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION
      
         HRESULT = HTMLDocumentEvents2_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
         HTMLDocumentEvents2_IUnknown_Release pCPC
         IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION
      
         pUnkSink = HTMLDocumentEvents2_BuildVtbl(pthis)
         IF ISTRUE pUnkSink THEN HRESULT = HTMLDocumentEvents2_IConnectionPoint_Advise(pCP, pUnkSink, dwCookie)
         HTMLDocumentEvents2_IUnknown_Release pCP
         pdwCookie = dwCookie
         FUNCTION = HRESULT
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Releases the events connection identified with the cookie returned by the ConnectEvents function
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_DisconnectEvents (BYVAL pthis AS DWORD, BYVAL dwCookie AS DWORD) AS LONG
      
         LOCAL HRESULT AS LONG                 ' HRESULT code
         LOCAL pCPC AS DWORD                   ' IConnectionPointContainer
         LOCAL pCP AS DWORD                    ' IConnectionPoint
         LOCAL IID_CPC AS GUID                 ' IID_IConnectionPointContainer
         LOCAL IID_CP AS GUID                  ' ConnectionEvents dispinterface
      
         IID_CPC = GUID$("{B196B284-BAB4-101A-B69C-00AA00341D07}")
         IID_CP  = GUID$("{3050F613-98B5-11CF-BB82-00AA00BDCE0B}")
      
         IF pthis = 0 THEN FUNCTION = -1 : EXIT FUNCTION
         HRESULT = HTMLDocumentEvents2_IUnknown_QueryInterface(pthis, IID_CPC, pCPC)
         IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION
      
         HRESULT = HTMLDocumentEvents2_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
         HTMLDocumentEvents2_IUnknown_Release pCPC
         IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION
      
         HRESULT = HTMLDocumentEvents2_IConnectionPoint_Unadvise(pCP, dwCookie)
         HTMLDocumentEvents2_IUnknown_Release pCP
         FUNCTION = HRESULT
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onhelp
      ' Fires when the user presses the F1 key while the browser is the active window.
      ' Member identifier: &H8001000A (-2147418102)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_onhelp (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onclick
      ' Fires when the user clicks the left mouse button on the object.
      ' Member identifier: &HFFFFFDA8 (-600)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_onclick (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
         LOCAL ppElement AS DWORD             ' // Element that has fired the event
         LOCAL strId AS STRING                ' // Identifier of the element that has fired the event
         LOCAL strValue AS STRING             ' // Value of the property
      
         ' // Get a reference to the element that has fired the event
         IF pEvtObj THEN ppElement = IHTMLEventObj_get_srcElement(pEvtObj)
         IF ppElement THEN
            ' // Get the identifier of the element that has fired the event
            strId = IHTMLElement_get_id(ppElement)
            SELECT CASE strId
               CASE "Button_1", "Button_2", "Button_3", "Button_4"
                  HTMLDocument_SetElementInnerHtmlById pthis, "output", "You have clicked " & strId
               CASE "Button_GetText"
                  strValue = HTMLDocument_GetElementValueById(pthis, "Input_Text")
                  MSGBOX strValue
            END SELECT
            ' // Release the IHTMLElement interface
            HTMLDocumentEvents2_IUnknown_Release ppElement
         END IF
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: ondblclick
      ' Fires when the user double-clicks the object.
      ' Member identifier: &HFFFFFDA7 (-601)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_ondblclick (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onkeydown
      ' Fires when the user presses a key.
      ' Member identifier: &HFFFFFDA6 (-602)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onkeydown (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onkeyup
      ' Fires when the user releases a key.
      ' Member identifier: &HFFFFFDA4 (-604)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onkeyup (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onkeypress
      ' Fires when the user presses an alphanumeric key.
      ' Member identifier: &HFFFFFDA5 (-603)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_onkeypress (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onmousedown
      ' Fires when the user clicks the object with either mouse button.
      ' Member identifier: &HFFFFFDA3 (-605)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onmousedown (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onmousemove
      ' Fires when the user moves the mouse over the object.
      ' Member identifier: &HFFFFFDA2 (-606)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onmousemove (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onmouseup
      ' ires when the user releases a mouse button while the mouse is over the object.
      ' Member identifier: &HFFFFFDA1 (-607)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onmouseup (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onmouseout
      ' Fires when the user moves the mouse pointer outside the boundaries of the object.
      ' Member identifier: &H80010009 (-2147418103)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onmouseout (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onmouseover
      ' Fires when the user moves the mouse pointer into the object.
      ' Member identifier: &H80010008 (-2147418104)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onmouseover (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onreadystatechange
      ' Fires when the state of the object has changed.
      ' Member identifier: &HFFFFFD9F (-609)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onreadystatechange (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onbeforeupdate
      ' Fires on a databound object before updating the associated data in the data source object.
      ' Member identifier: &H80010004 (-2147418108)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_onbeforeupdate (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onafterupdate
      ' Fires on a databound object after successfully updating the associated data in the data
      ' source object.
      ' Member identifier: &H80010005 (-2147418107)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onafterupdate (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onrowexit
      ' Fires just before the data source control changes the current row in the object.
      ' Member identifier: &H80010006 (-2147418106)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_onrowexit (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onrowenter
      ' Fires to indicate that the current row has changed in the data source and new data
      ' values are available on the object.
      ' Member identifier: &H80010007 (-2147418105)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onrowenter (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: ondragstart
      ' Fires on the source object when the user starts to drag a text selection or selected object.
      ' Member identifier: &H8001000B (-2147418101)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_ondragstart (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onselectstart
      ' Fires when the object is being selected.
      ' Member identifier: &H8001000C (-2147418100)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_onselectstart (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onerrorupdate
      ' Fires on a databound object when an error occurs while updating the associated data in
      ' the data source object.
      ' Member identifier: &H8001000D (-2147418099)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_onerrorupdate (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: oncontextmenu
      ' Fires when the user clicks the right mouse button in the client area, opening the
      ' context menu.
      ' Member identifier: &H000003FF (1023)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_oncontextmenu (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onstop
      ' Fires when the user clicks the Stop button or leaves the Web page.
      ' Member identifier: &H00000402 (1026)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_onstop (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onrowsdelete
      ' Fires when rows are about to be deleted from the recordset.
      ' Member identifier: &H80010020 (-2147418080)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onrowsdelete (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onrowsinserted
      ' Fires just after new rows are inserted in the current recordset.
      ' Member identifier: &H80010021 (-2147418079)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onrowsinserted (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: oncellchange
      ' Fires when data changes in the data provider.
      ' Member identifier: &H80010022 (-2147418078)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_oncellchange (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onpropertychange
      ' Fires when a property changes on the object.
      ' Member identifier: &H80010013 (-2147418093)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onpropertychange (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: ondatasetchanged
      ' Fires when the data set exposed by a data source object changes.
      ' Member identifier: &H8001000E (-2147418098)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_ondatasetchanged (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: ondataavailable
      ' Fires periodically as data arrives from data source objects that asynchronously transmit
      ' their data.
      ' Member identifier: &H8001000F (-2147418097)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_ondataavailable (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: ondatasetcomplete
      ' Fires to indicate that all data is available from the data source object.
      ' Member identifier: &H80010010 (-2147418096)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_ondatasetcomplete (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onbeforeeditfocus
      ' Fires before an object contained in an editable element enters a UI-activated state or
      ' when an editable container object is control selected.
      ' Member identifier: &H00000403 (1027)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onbeforeeditfocus (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onselectionchange
      ' Fires when the selection state of a document changes.
      ' Member identifier: &H0000040D (1037)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onselectionchange (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: oncontrolselect
      ' Fires when the user is about to make a control selection of the object.
      ' Member identifier: &H0000040C (1036)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_oncontrolselect (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onmousewheel
      ' Fires when the wheel button is rotated.
      ' Member identifier: &H00000409 (1033)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onmousewheel (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onfocusin
      ' Fires for an element just prior to setting focus on that element.
      ' Member identifier: &H00000418 (1048)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onfocusin (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onfocusout
      ' Fires for the current element with focus immediately after moving focus to another element.
      ' Member identifier: &H00000419 (1049)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onfocusout (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onactivate
      ' Fires when the object is set as the active element.
      ' Member identifier: &H00000414 (1044)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onactivate (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: ondeactivate
      ' Fires when the IHTMLDocument2::activeElement is changed from the current object to
      ' another object in the parent document.
      ' Member identifier: &H00000415 (1045)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_ondeactivate (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onbeforeactivate
      ' Fires immediately before the object is set as the active element.
      ' Member identifier: &H00000417 (1047)
      ' ****************************************************************************************
      SUB HTMLDocumentEvents2_onbeforeactivate (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      END SUB
      ' ****************************************************************************************
      
      ' ****************************************************************************************
      ' Function name: onbeforedeactivate
      ' Fires immediately before the IHTMLDocument2::activeElement is changed from the current
      ' object to another object in the parent document.
      ' Member identifier: &H0000040A (1034)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_onbeforedeactivate (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS) AS LONG
      
      '  Retrieve the IUnknown or IDispatch of the control that has fired the event.
         LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
      '  Pointer to access the parameter
         LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
      '  Pointer to an IHTMLEventObj interface for the current event.
         LOCAL pEvtObj AS DWORD : pEvtObj = VARIANT#(@pv[0])
      
      '  ===========================================================================================
      '  *** Put your code here ***
      '  ===========================================================================================
      
      '  Return Value: If the event bubbles and is cancellable, return %TRUE to prevent the
      '  event from bubbling to other event handlers in the document tree. Return %FALSE to
      '  allow bubbling.
         FUNCTION = %FALSE
      
      END FUNCTION
      ' ****************************************************************************************
      
      
      ' ****************************************************************************************
      ' HRESULT Invoke([in] I4 dispidMember, [in] *GUID riid, [in] UI4 lcid, [in] UI2 wFlags, [in] *DISPPARAMS pdispparams, [out] *VARIANT pvarResult, [out] *EXCEPINFO pexcepinfo, [out] *UINT puArgErr)
      ' ****************************************************************************************
      FUNCTION HTMLDocumentEvents2_Invoke (BYVAL pCookie AS HTMLDocumentEvents2_IDispatchVtbl PTR, BYVAL dispidMember AS LONG, BYREF riid AS GUID, _
         BYVAL lcid AS DWORD, BYVAL wFlags AS WORD, BYREF pdispparams AS DISPPARAMS, BYREF pvarResult AS VARIANT, _
         BYREF pexcepinfo AS HTMLDocumentEvents2_EXCEPINFO, BYREF puArgErr AS DWORD) AS LONG
      
         FUNCTION = %FALSE
      
         IF VARPTR(pdispparams) THEN
      
            SELECT CASE AS LONG dispidMember
               CASE &H8001000A  ' (-2147418102)  ' // onhelp
                  FUNCTION = HTMLDocumentEvents2_onhelp(pCookie, pdispparams)
               CASE &HFFFFFDA8  ' (-600)  ' // onclick
                  FUNCTION = HTMLDocumentEvents2_onclick(pCookie, pdispparams)
               CASE &HFFFFFDA7  ' (-601)  ' // ondblclick
                  FUNCTION = HTMLDocumentEvents2_ondblclick(pCookie, pdispparams)
               CASE &HFFFFFDA6  ' (-602)  ' // onkeydown
                  HTMLDocumentEvents2_onkeydown pCookie, pdispparams
               CASE &HFFFFFDA4  ' (-604)  ' // onkeyup
                  HTMLDocumentEvents2_onkeyup pCookie, pdispparams
               CASE &HFFFFFDA5  ' (-603)  ' // onkeypress
                  FUNCTION = HTMLDocumentEvents2_onkeypress(pCookie, pdispparams)
               CASE &HFFFFFDA3  ' (-605)  ' // onmousedown
                  HTMLDocumentEvents2_onmousedown pCookie, pdispparams
               CASE &HFFFFFDA2  ' (-606)  ' // onmousemove
                  HTMLDocumentEvents2_onmousemove pCookie, pdispparams
               CASE &HFFFFFDA1  ' (-607)  ' // onmouseup
                  HTMLDocumentEvents2_onmouseup pCookie, pdispparams
               CASE &H80010009  ' (-2147418103)  ' // onmouseout
                  HTMLDocumentEvents2_onmouseout pCookie, pdispparams
               CASE &H80010008  ' (-2147418104)  ' // onmouseover
                  HTMLDocumentEvents2_onmouseover pCookie, pdispparams
               CASE &HFFFFFD9F  ' (-609)  ' // onreadystatechange
                  HTMLDocumentEvents2_onreadystatechange pCookie, pdispparams
               CASE &H80010004  ' (-2147418108)  ' // onbeforeupdate
                  FUNCTION = HTMLDocumentEvents2_onbeforeupdate(pCookie, pdispparams)
               CASE &H80010005  ' (-2147418107)  ' // onafterupdate
                  HTMLDocumentEvents2_onafterupdate pCookie, pdispparams
               CASE &H80010006  ' (-2147418106)  ' // onrowexit
                  FUNCTION = HTMLDocumentEvents2_onrowexit(pCookie, pdispparams)
               CASE &H80010007  ' (-2147418105)  ' // onrowenter
                  HTMLDocumentEvents2_onrowenter pCookie, pdispparams
               CASE &H8001000B  ' (-2147418101)  ' // ondragstart
                  FUNCTION = HTMLDocumentEvents2_ondragstart(pCookie, pdispparams)
               CASE &H8001000C  ' (-2147418100)  ' // onselectstart
                  FUNCTION = HTMLDocumentEvents2_onselectstart(pCookie, pdispparams)
               CASE &H8001000D  ' (-2147418099)  ' // onerrorupdate
                  FUNCTION = HTMLDocumentEvents2_onerrorupdate(pCookie, pdispparams)
               CASE &H000003FF  ' (1023)  ' // oncontextmenu
                  FUNCTION = HTMLDocumentEvents2_oncontextmenu(pCookie, pdispparams)
               CASE &H00000402  ' (1026)  ' // onstop
                  FUNCTION = HTMLDocumentEvents2_onstop(pCookie, pdispparams)
               CASE &H80010020  ' (-2147418080)  ' // onrowsdelete
                  HTMLDocumentEvents2_onrowsdelete pCookie, pdispparams
               CASE &H80010021  ' (-2147418079)  ' // onrowsinserted
                  HTMLDocumentEvents2_onrowsinserted pCookie, pdispparams
               CASE &H80010022  ' (-2147418078)  ' // oncellchange
                  HTMLDocumentEvents2_oncellchange pCookie, pdispparams
               CASE &H80010013  ' (-2147418093)  ' // onpropertychange
                  HTMLDocumentEvents2_onpropertychange pCookie, pdispparams
               CASE &H8001000E  ' (-2147418098)  ' // ondatasetchanged
                  HTMLDocumentEvents2_ondatasetchanged pCookie, pdispparams
               CASE &H8001000F  ' (-2147418097)  ' // ondataavailable
                  HTMLDocumentEvents2_ondataavailable pCookie, pdispparams
               CASE &H80010010  ' (-2147418096)  ' // ondatasetcomplete
                  HTMLDocumentEvents2_ondatasetcomplete pCookie, pdispparams
               CASE &H00000403  ' (1027)  ' // onbeforeeditfocus
                  HTMLDocumentEvents2_onbeforeeditfocus pCookie, pdispparams
               CASE &H0000040D  ' (1037)  ' // onselectionchange
                  HTMLDocumentEvents2_onselectionchange pCookie, pdispparams
               CASE &H0000040C  ' (1036)  ' // oncontrolselect
                  FUNCTION = HTMLDocumentEvents2_oncontrolselect(pCookie, pdispparams)
               CASE &H00000409  ' (1033)  ' // onmousewheel
                  HTMLDocumentEvents2_onmousewheel pCookie, pdispparams
               CASE &H00000418  ' (1048)  ' // onfocusin
                  HTMLDocumentEvents2_onfocusin pCookie, pdispparams
               CASE &H00000419  ' (1049)  ' // onfocusout
                  HTMLDocumentEvents2_onfocusout pCookie, pdispparams
               CASE &H00000414  ' (1044)  ' // onactivate
                  HTMLDocumentEvents2_onactivate pCookie, pdispparams
               CASE &H00000415  ' (1045)  ' // ondeactivate
                  HTMLDocumentEvents2_ondeactivate pCookie, pdispparams
               CASE &H00000417  ' (1047)  ' // onbeforeactivate
                  HTMLDocumentEvents2_onbeforeactivate pCookie, pdispparams
               CASE &H0000040A  ' (1034)  ' // onbeforedeactivate
                  FUNCTION = HTMLDocumentEvents2_onbeforedeactivate(pCookie, pdispparams)
      
            END SELECT
      
         END IF
      
      END FUNCTION
      ' ****************************************************************************************

      ------------------
      Forum: http://www.jose.it-berater.org/smfforum/index.php

      Comment


      • #4
        Save it as DWebBrowserEvents2.inc
        Code:
        ' ****************************************************************************************
        ' DWebBrowserEvents2 dispatch interface
        ' IID = {34A715A0-6587-11D0-924A-0020AFC7AC4D}
        ' Microsoft documentation:
        ' [url="http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/ifaces/dwebbrowserevents2/dwebbrowserevents2.asp"]http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/ifaces/dwebbrowserevents2/dwebbrowserevents2.asp[/url] 
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' EXCEPINFO structure
        ' ****************************************************************************************
        TYPE DWebBrowserEvents2_EXCEPINFO
           wCode AS WORD               ' An error code describing the error.
           wReserved AS WORD           ' Reserved
           bstrSource AS DWORD         ' Source of the exception.
           bstrDescription AS DWORD    ' Textual description of the error.
           bstrHelpFile AS DWORD       ' Help file path.
           dwHelpContext AS DWORD      ' Help context ID.
           pvReserved AS DWORD         ' Reserved.
           pfnDeferredFillIn AS DWORD  ' Pointer to function that fills in Help and description info.
           scode AS DWORD              ' An error code describing the error.
        END TYPE
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' Returns a pointer to a specified interface on an object to which a client currently holds an
        ' interface pointer.
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_IUnknown_QueryInterface (BYVAL pthis AS DWORD PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
           LOCAL HRESULT AS LONG
           CALL DWORD @@pthis[0] USING DWebBrowserEvents2_IUnknown_QueryInterface(pthis, riid, ppvObj) TO HRESULT
           FUNCTION = HRESULT
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' Decrements the reference count for the calling interface on a object. If the reference count
        ' on the object falls to 0, the object is freed from memory.
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_IUnknown_Release (BYVAL pthis AS DWORD PTR) AS DWORD
           LOCAL DWRESULT AS DWORD
           CALL DWORD @@pthis[2] USING DWebBrowserEvents2_IUnknown_Release(pthis) TO DWRESULT
           FUNCTION = DWRESULT
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' IConnectionPointContainer::FindConnectionPoint
        ' Returns a pointer to the IConnectionPoint interface of a connection point for a specified IID,
        ' if that IID describes a supported outgoing interface.
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_IConnectionPointContainer_FindConnectionPoint ( _
           BYVAL pthis AS DWORD PTR, BYREF riid AS GUID, BYREF ppCP AS DWORD) AS LONG
           LOCAL HRESULT AS LONG
           CALL DWORD @@pthis[4] USING DWebBrowserEvents2_IConnectionPointContainer_FindConnectionPoint(pthis, riid, ppCP) TO HRESULT
           FUNCTION = HRESULT
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' IConnectionPoint::Advise
        ' Establishes a connection between the connection point object and the client's sink.
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_IConnectionPoint_Advise (BYVAL pthis AS DWORD PTR, _
           BYVAL pUnkSink AS DWORD, BYREF pdwCookie AS DWORD) AS LONG
           LOCAL HRESULT AS LONG
           CALL DWORD @@pthis[5] USING DWebBrowserEvents2_IConnectionPoint_Advise(pthis, pUnkSink, pdwCookie) TO HRESULT
           FUNCTION = HRESULT
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' IConnectionPoint::Unadvise
        ' Terminates an advisory connection previously established through IConnectionPoint_Advise.
        ' The dwCookie parameter identifies the connection to terminate.
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_IConnectionPoint_Unadvise (BYVAL pthis AS DWORD PTR, BYVAL dwCookie AS DWORD) AS LONG
           LOCAL HRESULT AS LONG
           CALL DWORD @@pthis[6] USING DWebBrowserEvents2_IConnectionPoint_Unadvise(pthis, dwCookie) TO HRESULT
           FUNCTION = HRESULT
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' IDispatch virtual table
        ' ****************************************************************************************
        TYPE DWebBrowserEvents2_IDispatchVtbl
           QueryInterface AS DWORD     ' Returns pointers to supported interfaces
           AddRef AS DWORD             ' Increments reference count
           Release AS DWORD            ' Decrements reference count
           GetTypeInfoCount AS DWORD   ' Retrieves the number of type descriptions
           GetTypeInfo AS DWORD        ' Retrieves a description of object's programmable interface
           GetIDsOfNames AS DWORD      ' Maps name of method or property to DispId
           Invoke AS DWORD             ' Calls one of the object's methods, or gets/sets one of its properties
           pVtblAddr AS DWORD          ' Address of the virtual table
           cRef AS DWORD               ' Reference counter
           pthis AS DWORD              ' IUnknown or IDispatch of the control that fires the events
           fNewWindow3 AS LONG         ' Flag - indicates that the NewWindow3 event has been fired
           ppdoc AS DWORD              ' Reference to the IHTMLDocument interface
           pDocCookie AS DWORD         ' Reference to the HTMLDocumentEvents2 interface
        END TYPE
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' UI4 AddRef()
        ' Increments the reference counter.
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_AddRef (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR) AS DWORD
           INCR @@pCookie.cRef
           FUNCTION = @@pCookie.cRef
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' HRESULT QueryInterface([in] *GUID riid, [out] **VOID ppvObj)
        ' Returns the IUnknown of our class and increments the reference counter.
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_QueryInterface (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, _
           BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
           ppvObj = pCookie
           DWebBrowserEvents2_AddRef pCookie
           FUNCTION = %S_OK
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' UI4 Release()
        ' Releases our class if there is only a reference to him and decrements the reference counter.
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_Release (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR) AS DWORD
           LOCAL pVtblAddr AS DWORD
           IF @@pCookie.cRef = 1 THEN
              IF @@pCookie.ppdoc THEN
                 IF @@pCookie.pDocCookie THEN HTMLDocumentEvents2_DisconnectEvents @@pCookie.ppdoc, @@pCookie.pDocCookie
                 DWebBrowserEvents2_IUnknown_Release @@pCookie.ppdoc
                 @@pCookie.pDocCookie = 0
              END IF
              pVtblAddr = @@pCookie.pVtblAddr
              IF ISFALSE HeapFree(GetProcessHeap(), 0, BYVAL pVtblAddr) THEN
                 FUNCTION = @@pCookie.cRef
                 EXIT FUNCTION
              END IF
           END IF
           DECR @@pCookie.cRef
           FUNCTION = @@pCookie.cRef
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' HRESULT GetTypeInfoCount([out] *UINT pctinfo)
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_GetTypeInfoCount (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pctInfo AS DWORD) AS LONG
           FUNCTION = %E_NOTIMPL
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' HRESULT GetTypeInfo([in] UINT itinfo, [in] UI4 lcid, [out] **VOID pptinfo)
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_GetTypeInfo (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, _
           BYVAL itinfo AS DWORD, BYVAL lcid AS DWORD, BYREF pptinfo AS DWORD) AS LONG
           FUNCTION = %E_NOTIMPL
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' HRESULT GetIDsOfNames([in] *GUID riid, [in] **I1 rgszNames, [in] UINT cNames, [in] UI4 lcid, [out] *I4 rgdispid)
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_GetIDsOfNames ( BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, _
           BYREF riid AS GUID, BYVAL rgszNames AS DWORD, BYVAL cNames AS DWORD, BYVAL lcid AS DWORD, BYREF rgdispid AS LONG) AS LONG
           FUNCTION = %E_NOTIMPL
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' Builds the IDispatch Virtual Table
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_BuildVtbl (BYVAL pthis AS DWORD) AS DWORD
        
           LOCAL pVtbl AS DWebBrowserEvents2_IDispatchVtbl PTR
           LOCAL pUnk AS DWebBrowserEvents2_IDispatchVtbl PTR
        
           pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
           IF pVtbl = 0 THEN EXIT FUNCTION
        
           @pVtbl.QueryInterface   = CODEPTR(DWebBrowserEvents2_QueryInterface)
           @pVtbl.AddRef           = CODEPTR(DWebBrowserEvents2_AddRef)
           @pVtbl.Release          = CODEPTR(DWebBrowserEvents2_Release)
           @pVtbl.GetTypeInfoCount = CODEPTR(DWebBrowserEvents2_GetTypeInfoCount)
           @pVtbl.GetTypeInfo      = CODEPTR(DWebBrowserEvents2_GetTypeInfo)
           @pVtbl.GetIDsOfNames    = CODEPTR(DWebBrowserEvents2_GetIDsOfNames)
           @pVtbl.Invoke           = CODEPTR(DWebBrowserEvents2_Invoke)
           @pVtbl.pVtblAddr        = pVtbl
           @pVtbl.pthis            = pthis
           @pVtbl.fNewWindow3      = %FALSE
        
           pUnk = VARPTR(@pVtbl.pVtblAddr)
           FUNCTION = pUnk
        
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' Establishes a connection between the connection point object and the client's sink.
        ' Returns a token that uniquely identifies this connection.
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_ConnectEvents (BYVAL pthis AS DWORD, BYREF pdwCookie AS DWORD) AS LONG
        
           LOCAL HRESULT AS LONG                 ' HRESULT code
           LOCAL pCPC AS DWORD                   ' IConnectionPointContainer
           LOCAL pCP AS DWORD                    ' IConnectionPoint
           LOCAL IID_CPC AS GUID                 ' IID_IConnectionPointContainer
           LOCAL IID_CP AS GUID                  ' Events dispinterface
           LOCAL dwCookie AS DWORD               ' Returned token
           LOCAL pUnkSink AS DWORD               ' IUnknown of the class
        
           IID_CPC = GUID$("{B196B284-BAB4-101A-B69C-00AA00341D07}")
           IID_CP  = GUID$("{34A715A0-6587-11D0-924A-0020AFC7AC4D}")
        
           IF pthis = 0 THEN FUNCTION = -1 : EXIT FUNCTION
           HRESULT = DWebBrowserEvents2_IUnknown_QueryInterface(pthis, IID_CPC, pCPC)
           IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION
        
           HRESULT = DWebBrowserEvents2_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
           DWebBrowserEvents2_IUnknown_Release pCPC
           IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION
        
           pUnkSink = DWebBrowserEvents2_BuildVtbl(pthis)
           IF ISTRUE pUnkSink THEN HRESULT = DWebBrowserEvents2_IConnectionPoint_Advise(pCP, pUnkSink, dwCookie)
           DWebBrowserEvents2_IUnknown_Release pCP
           pdwCookie = dwCookie
           FUNCTION = HRESULT
        
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' Releases the events connection identified with the cookie returned by the ConnectEvents function
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_DisconnectEvents (BYVAL pthis AS DWORD, BYVAL dwCookie AS DWORD) AS LONG
        
           LOCAL HRESULT AS LONG                 ' HRESULT code
           LOCAL pCPC AS DWORD                   ' IConnectionPointContainer
           LOCAL pCP AS DWORD                    ' IConnectionPoint
           LOCAL IID_CPC AS GUID                 ' IID_IConnectionPointContainer
           LOCAL IID_CP AS GUID                  ' ConnectionEvents dispinterface
        
           IID_CPC = GUID$("{B196B284-BAB4-101A-B69C-00AA00341D07}")
           IID_CP  = GUID$("{34A715A0-6587-11D0-924A-0020AFC7AC4D}")
        
           IF pthis = 0 THEN FUNCTION = -1 : EXIT FUNCTION
           HRESULT = DWebBrowserEvents2_IUnknown_QueryInterface(pthis, IID_CPC, pCPC)
           IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION
        
           HRESULT = DWebBrowserEvents2_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
           DWebBrowserEvents2_IUnknown_Release pCPC
           IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION
        
           HRESULT = DWebBrowserEvents2_IConnectionPoint_Unadvise(pCP, dwCookie)
           DWebBrowserEvents2_IUnknown_Release pCP
           FUNCTION = HRESULT
        
        END FUNCTION
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' StatusTextChange
        ' Member identifier: &H00000066 (102)
        ' Fires when the status bar text of the object has changed.
        ' The container can use the information provided by this event to update the text of a status bar.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_StatusTextChange (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Status bar text.
           LOCAL strText AS STRING : strText = VARIANT$(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' ProgressChange
        ' Member identifier: &H0000006C (108)
        ' Fires when the progress of a download operation is updated on the object.
        ' The container can use the information provided by this event to display the number of bytes
        ' downloaded so far or to update a progress indicator.
        ' To calculate the percentage of progress to show in a progress indicator, multiply the value
        ' of Progress by 100 and divide by the value of ProgressMax (unless Progress is -1, in which
        ' case the container can indicate that the operation is finished or hide the progress indicator).
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_ProgressChange (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the values of the parameters.
           LOCAL Progress AS LONG : Progress = VARIANT#(@pv[1])
           LOCAL ProgressMax AS LONG : ProgressMax = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' CommandStateChange
        ' Member identifier: &H00000069 (105)
        ' Fires when the enabled state of a command changes.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_CommandStateChange (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameters.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the values of the parameters.
           LOCAL nCommand AS LONG : nCommand = VARIANT#(@pv[1])
           LOCAL pfEnable AS INTEGER : pfEnable = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' DownloadBegin
        ' Member identifier: &H0000006A (106)
        ' Fires when a navigation operation is beginning.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_DownloadBegin (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' DownloadComplete
        ' Member identifier: &H00000068 (104)
        ' Fires when a navigation operation finishes, is halted, or fails.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_DownloadComplete (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        
           ' Connect to the events fired by the downloaded document
           LOCAL ppdoc AS DWORD
           LOCAL pDocCookie AS DWORD
           ppdoc = IWebBrowser2_GetDocument(pthis)
           IF ppdoc THEN
              HTMLDocumentEvents2_ConnectEvents ppdoc, pDocCookie
              @@pCookie.ppdoc = ppdoc
              @@pCookie.pDocCookie = pDocCookie
           END IF
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' TitleChange
        ' Member identifier: &H00000071 (113)
        ' Fires when the title of a document in the object becomes available or changes.
        ' Because the title might change while an HTML page is downloading, the URL of the document is
        ' set as the title. After the title specified in the HTML page, if there is one, is parsed, the
        ' title is changed to reflect the actual title.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_TitleChange (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL strText AS STRING : strText = VARIANT$(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' BeforeNavigate2
        ' Member identifier: &H000000FA (250)
        ' Fires before navigation occurs in the given object (on either a window or frameset element).
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_BeforeNavigate2 (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointers to access the parameters.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
           LOCAL pvapi AS VARIANTAPI PTR : pvapi = pv
        '  Get the values of the parameters.
           LOCAL pDisp AS DWORD : pDisp = VARIANT#(@pv[6])
           LOCAL URL AS VARIANT : URL = @pv[5]
           LOCAL Flags AS VARIANT : Flags = @pv[4]
           LOCAL TargetFrameName AS VARIANT : TargetFrameName = @pv[3]
           LOCAL PostData AS VARIANT : PostData = @pv[2]
           LOCAL Headers AS VARIANT : Headers = @pv[1]
           STATIC bCancel AS INTEGER : bCancel = VARIANT#(@pv[0])
        '  To return a value, use: bCancel = <value> : @pvapi[0][email protected] = bCancel
        
           ' =====================================================================
           ' If there was a previous loaded page, disconnect from the
           ' HTMLDocumentEvents2 interface
           ' =====================================================================
           LOCAL ppdoc AS DWORD
           LOCAL pDocCookie AS DWORD
           IF @@pCookie.ppdoc THEN
              IF @@pCookie.pDocCookie THEN HTMLDocumentEvents2_DisconnectEvents @@pCookie.ppdoc, @@pCookie.pDocCookie
              DWebBrowserEvents2_IUnknown_Release @@pCookie.ppdoc
              @@pCookie.pDocCookie = 0
           END IF
           ' =====================================================================
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' NewWindow2
        ' Member identifier: &H000000FB (251)
        ' Fires when a new window is to be created.
        ' BUG: [url="http://support.microsoft.com/kb/294870/EN-US/"]http://support.microsoft.com/kb/294870/EN-US/[/url] 
        ' When you use the NewWindow2 event in Internet Explorer 5.5, you may encounter the following
        ' problems:
        ' • If you click a link that performs a window.open method to browse to a new site, you receive
        '   an "unspecified error" error message.
        ' • If you right-click a link and then click Open in New Window, it does not navigate at all.
        ' When you use NewWindow2 in Internet Explorer 5, you may encounter the following problems:
        ' • If you click a link that performs a window.open method to browse to a new site, it does
        '   not navigate at all.
        ' • If you right-click a link and then click Open in New Window, you receive an "unspecified
        '    error" error message.
        ' When you use NewWindow2 in Internet Explorer 4.x, you may encounter the following problems:
        ' • If click a link that performs a window.open method to browse to a new site, it does not
        '   navigate.
        ' • If you right-click a link and then click Open in New Window, you receive an "unspecified
        '   error" error message.
        ' To work around this problem, open the link in a new window within your application instead
        ' of opening it in the same window.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_NewWindow2 (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointers to access the parameters.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
           LOCAL pvapi AS VARIANTAPI PTR : pvapi = pv
        '  Get the values of the parameters.
           STATIC ppDisp AS DWORD : ppDisp = VARIANT#(@pv[1])
        '  To return a value, use: ppDisp = <value> : @pvapi[1][email protected] = ppDisp
           STATIC bCancel AS INTEGER : bCancel = VARIANT#(@pv[0])
        '  To return a value, use: bCancel = <value> : @pvapi[0][email protected] = bCancel
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' NavigateComplete2
        ' Member identifier: &H000000FC (252)
        ' Fires after a navigation to a link is completed on either a window or frameSet element.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_NavigateComplete2 (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Variants to access the parameters.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
           LOCAL pvapi AS VARIANTAPI PTR : pvapi = pv
        '  Get the values of the parameters.
           LOCAL pDisp AS DWORD : pDisp = VARIANT#(@pv[1])
           LOCAL URL AS VARIANT : URL = @pv[0]
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' DocumentComplete
        ' Member identifier: &H00000103 (259)
        ' Fires when a document has been completely loaded and initialized.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_DocumentComplete (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointers to access the parameters.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
           LOCAL pvapi AS VARIANTAPI PTR : pvapi = pv
        '  Get the values of the parameters.
           LOCAL pDisp AS DWORD : pDisp = VARIANT#(@pv[1])
           LOCAL URL AS VARIANT : URL = @pv[0]
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' OnVisible
        ' Member identifier: &H000000FE (254)
        ' Fires when the IWebBrowser2::Visible property of the object is changed.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_OnVisible (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL Visible AS INTEGER : Visible = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' WindowSetResizable
        ' Member identifier: &H00000106 (262)
        ' Fires to indicate whether the host window should allow or disallow resizing of the object.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_WindowSetResizable (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL Resizable AS INTEGER : Resizable = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' WindowSetLeft
        ' Member identifier: &H00000108 (264)
        ' Fires when the object changes its left position.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_WindowSetLeft (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL prmLeft AS LONG : prmLeft = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' Function name: WindowSetTop
        ' Dispatch interface name: DWebBrowserEvents2
        ' Member identifier: &H00000109 (265)
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_WindowSetTop (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL Top AS LONG : Top = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' WindowSetWidth
        ' Member identifier: &H0000010A (266)
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_WindowSetWidth (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL nWidth AS LONG : nWidth = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' WindowSetHeight
        ' Member identifier: &H0000010B (267)
        ' Fires when the object changes its height.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_WindowSetHeight (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL Height AS LONG : Height = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' WindowClosing
        ' Member identifier: &H00000107 (263)
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_WindowClosing (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointers to access the parameters.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
           LOCAL pvapi AS VARIANTAPI PTR : pvapi = pv
        '  Get the values of the parameters.
           LOCAL IsChildWindow AS INTEGER : IsChildWindow = VARIANT#(@pv[1])
           STATIC bCancel AS INTEGER : bCancel = VARIANT#(@pv[0])
        '  To return a value, use: bCancel = <value> : @pvapi[0][email protected] = bCancel
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' ClientToHostWindow
        ' Member identifier: &H0000010C (268)
        ' Fires to request that the client window size be converted to the host window size.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_ClientToHostWindow (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointers to access the parameters.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
           LOCAL pvapi AS VARIANTAPI PTR : pvapi = pv
        '  Get the values of the parameters.
           STATIC CX AS LONG : CX = VARIANT#(@pv[1])
        '  To return a value, use: CX = <value> : @pvapi[1][email protected] = CX
           STATIC CY AS LONG : CY = VARIANT#(@pv[0])
        '  To return a value, use: CY = <value> : @pvapi[0][email protected] = CY
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' SetSecureLockIcon
        ' Member identifier: &H0000010D (269)
        ' Fires when there is a change in encryption level.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_SetSecureLockIcon (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL SecureLockIcon AS LONG : SecureLockIcon = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' FileDownload
        ' Member identifier: &H0000010E (270)
        ' Fires to indicate that a file download is about to occur. If a file download dialog is to be
        ' displayed, this event is fired prior to the display of the dialog.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_FileDownload (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointers to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
           LOCAL pvapi AS VARIANTAPI PTR : pvapi = pv
        '  Get the value of the parameter.
           STATIC bCancel AS INTEGER : bCancel = VARIANT#(@pv[0])
        '  To return a value, use: bCancel = <value> : @pvapi[0][email protected] = bCancel
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' NavigateError
        ' Member identifier: &H0000010F (271)
        ' Fires when an error occurs during navigation.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_NavigateError (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointers to access the parameters
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
           LOCAL pvapi AS VARIANTAPI PTR : pvapi = pv
        '  Get the values of the parameters.
           LOCAL pDisp AS DWORD : pDisp = VARIANT#(@pv[4])
           LOCAL URL AS VARIANT : URL = @pv[3]
           LOCAL prmFrame AS VARIANT : prmFrame = @pv[2]
           LOCAL StatusCode AS VARIANT : StatusCode = @pv[1]
           STATIC bCancel AS INTEGER : bCancel = VARIANT#(@pv[0])
        '  To return a value, use: bCancel = <value> : @pvapi[0][email protected] = bCancel
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' PrintTemplateInstantiation
        ' Member identifier: &H000000E1 (225)
        ' Fires when a print template has been instantiated.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_PrintTemplateInstantiation (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL pDisp AS DWORD : pDisp = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' PrintTemplateTeardown
        ' Member identifier: &H000000E2 (226)
        ' Fires when a print template has been destroyed.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_PrintTemplateTeardown (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IDispatch of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL pDisp AS DWORD : pDisp = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' PrivacyImpactedStateChange
        ' Member identifier: &H00000110 (272)
        ' Fired when an event occurs that impacts privacy or when a user navigates away from a URL
        ' that has impacted privacy.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_PrivacyImpactedStateChange (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IUnknown of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointer to access the parameter.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
        '  Get the value of the parameter.
           LOCAL bImpacted AS INTEGER : bImpacted = VARIANT#(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        ' ****************************************************************************************
        ' Function name: NewWindow3
        ' Member identifier: &H00000111 (273)
        ' Raised when a new window is to be created. Extends DWebBrowserEvents2::NewWindow2 with
        ' additional information about the new window.
        ' Note: NewWindow3 is available only in Microsoft Windows XP Service Pack 2 (SP2) or later.
        ' ****************************************************************************************
        SUB DWebBrowserEvents2_NewWindow3 (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)
        
        '  Retrieve the IUnknown of the control that has fired the event.
           LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
        '  Pointers to access the parameters.
           LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
           LOCAL pvapi AS VARIANTAPI PTR : pvapi = pv
           STATIC ppDisp AS DWORD : ppDisp = VARIANT#(@pv[4])
        '  To return a value, use: ppDisp = <value> : @pvapi[4][email protected] = ppDisp
           STATIC bCancel AS INTEGER : bCancel = VARIANT#(@pv[3])
        '  To return a value, use: bCancel = <value> : @pvapi[0][email protected] = bCancel
           LOCAL dwFlags AS DWORD : dwFlags = VARIANT#(@pv[2])
           LOCAL strUrlContext AS STRING : strUrlContext = VARIANT$(@pv[1])
           LOCAL strUrl AS STRING : strUrl = VARIANT$(@pv[0])
        
        END SUB
        ' ****************************************************************************************
        
        
        ' ****************************************************************************************
        ' HRESULT Invoke([in] I4 dispidMember, [in] *GUID riid, [in] UI4 lcid, [in] UI2 wFlags, [in] *DISPPARAMS pdispparams, [out] *VARIANT pvarResult, [out] *EXCEPINFO pexcepinfo, [out] *UINT puArgErr)
        ' ****************************************************************************************
        FUNCTION DWebBrowserEvents2_Invoke (BYVAL pCookie AS DWebBrowserEvents2_IDispatchVtbl PTR, BYVAL dispidMember AS LONG, BYREF riid AS GUID, _
           BYVAL lcid AS DWORD, BYVAL wFlags AS WORD, BYREF pdispparams AS DISPPARAMS, BYREF pvarResult AS VARIANT, _
           BYREF pexcepinfo AS DWebBrowserEvents2_EXCEPINFO, BYREF puArgErr AS DWORD) AS LONG
        
           FUNCTION = %S_OK
        
           IF VARPTR(pdispparams) THEN
        
              SELECT CASE AS LONG dispidMember
                 CASE &H00000066  ' (102)  ' // StatusTextChange
                    DWebBrowserEvents2_StatusTextChange pCookie, pdispparams
                 CASE &H0000006C  ' (108)  ' // ProgressChange
                    DWebBrowserEvents2_ProgressChange pCookie, pdispparams
                 CASE &H00000069  ' (105)  ' // CommandStateChange
                    DWebBrowserEvents2_CommandStateChange pCookie, pdispparams
                 CASE &H0000006A  ' (106)  ' // DownloadBegin
                    DWebBrowserEvents2_DownloadBegin pCookie, pdispparams
                 CASE &H00000068  ' (104)  ' // DownloadComplete
                    DWebBrowserEvents2_DownloadComplete pCookie, pdispparams
                 CASE &H00000071  ' (113)  ' // TitleChange
                    DWebBrowserEvents2_TitleChange pCookie, pdispparams
                 CASE &H000000FA  ' (250)  ' // BeforeNavigate2
                    DWebBrowserEvents2_BeforeNavigate2 pCookie, pdispparams
                 CASE &H000000FB  ' (251)  ' // NewWindow2
                    DWebBrowserEvents2_NewWindow2 pCookie, pdispparams
                 CASE &H000000FC  ' (252)  ' // NavigateComplete2
                    DWebBrowserEvents2_NavigateComplete2 pCookie, pdispparams
                 CASE &H00000103  ' (259)  ' // DocumentComplete
                    DWebBrowserEvents2_DocumentComplete pCookie, pdispparams
                 CASE &H000000FE  ' (254)  ' // OnVisible
                    DWebBrowserEvents2_OnVisible pCookie, pdispparams
                 CASE &H00000106  ' (262)  ' // WindowSetResizable
                    DWebBrowserEvents2_WindowSetResizable pCookie, pdispparams
                 CASE &H00000108  ' (264)  ' // WindowSetLeft
                    DWebBrowserEvents2_WindowSetLeft pCookie, pdispparams
                 CASE &H00000109  ' (265)  ' // WindowSetTop
                    DWebBrowserEvents2_WindowSetTop pCookie, pdispparams
                 CASE &H0000010A  ' (266)  ' // WindowSetWidth
                    DWebBrowserEvents2_WindowSetWidth pCookie, pdispparams
                 CASE &H0000010B  ' (267)  ' // WindowSetHeight
                    DWebBrowserEvents2_WindowSetHeight pCookie, pdispparams
                 CASE &H00000107  ' (263)  ' // WindowClosing
                    DWebBrowserEvents2_WindowClosing pCookie, pdispparams
                 CASE &H0000010C  ' (268)  ' // ClientToHostWindow
                    DWebBrowserEvents2_ClientToHostWindow pCookie, pdispparams
                 CASE &H0000010D  ' (269)  ' // SetSecureLockIcon
                    DWebBrowserEvents2_SetSecureLockIcon pCookie, pdispparams
                 CASE &H0000010E  ' (270)  ' // FileDownload
                    DWebBrowserEvents2_FileDownload pCookie, pdispparams
                 CASE &H0000010F  ' (271)  ' // NavigateError
                    DWebBrowserEvents2_NavigateError pCookie, pdispparams
                 CASE &H000000E1  ' (225)  ' // PrintTemplateInstantiation
                    DWebBrowserEvents2_PrintTemplateInstantiation pCookie, pdispparams
                 CASE &H000000E2  ' (226)  ' // PrintTemplateTeardown
                    DWebBrowserEvents2_PrintTemplateTeardown pCookie, pdispparams
                 CASE &H00000110  ' (272)  ' // PrivacyImpactedStateChange
                    DWebBrowserEvents2_PrivacyImpactedStateChange pCookie, pdispparams
                 CASE &H00000111  ' (273)  ' // NewWindow3
                    DWebBrowserEvents2_NewWindow3 pCookie, pdispparams
        
              END SELECT
        
           END IF
        
        END FUNCTION
        ' ****************************************************************************************

        ------------------
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


        • #5
          Web based GUI example
          Code:
          #DIM ALL
          #COMPILE EXE
          #OPTION VERSION4
          #INCLUDE "WIN32API.INC"
          #INCLUDE "COMMCTRL.INC"
          #INCLUDE "IEWB2.INC"
          
          GLOBAL HtmlResult AS LONG
          
          TYPE SAFEARRAYBOUND
            cElements AS DWORD
            lLbound   AS LONG
          END TYPE
          
          DECLARE FUNCTION SafeArrayCreate LIB "OLEAUT32.DLL" ALIAS "SafeArrayCreate" (BYVAL vt AS WORD, BYVAL cDims AS DWORD, BYREF rgsabound AS SAFEARRAYBOUND) AS DWORD
          DECLARE FUNCTION SafeArrayDestroy LIB "OLEAUT32.DLL" ALIAS "SafeArrayDestroy" (BYVAL psa AS DWORD) AS DWORD
          DECLARE FUNCTION SafeArrayPutElement LIB "OLEAUT32.DLL" ALIAS "SafeArrayPutElement" (BYVAL psa AS DWORD, BYVAL rgIndices AS DWORD, BYVAL pv AS DWORD) AS DWORD
          
          ' ********************************************************************************************
          ' QueryInterface method
          ' ********************************************************************************************
          ' Returns a pointer to a specified interface on an object to which a client currently holds an
          ' interface pointer. You must release the returned interface, when no longer needed, with a call
          ' to the Release method.
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_HtmlQueryInterface (BYVAL pthis AS DWORD PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION HtmlQueryInterface (BYVAL pthis AS DWORD PTR, BYREF riid AS GUID) AS DWORD
              LOCAL ppvObj AS DWORD
              IF pthis = 0 THEN HtmlResult = %E_POINTER : EXIT FUNCTION
              CALL DWORD @@pthis[0] USING Proto_WbQueryInterface(pthis, riid, ppvObj) TO HtmlResult
              FUNCTION = ppvObj
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' AddRef method
          ' ********************************************************************************************
          ' The AddRef method increments the reference count for an interface on an object. It should be
          ' called for every new copy of a pointer to an interface on a given object.
          ' ********************************************************************************************
          FUNCTION HtmlAddRef (BYVAL pthis AS DWORD PTR) AS DWORD
              LOCAL DWRESULT AS LONG
              IF pthis = 0 THEN WbResult = %E_POINTER : EXIT FUNCTION
              CALL DWORD @@pthis[1] USING HtmlAddRef(pthis) TO DWRESULT
              FUNCTION = DWRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' Release method
          ' ********************************************************************************************
          ' Decrements the reference count for the calling interface on a object. If the reference count
          ' on the object falls to 0, the object is freed from memory.
          ' ********************************************************************************************
          FUNCTION HtmlRelease (BYVAL pthis AS DWORD PTR) AS DWORD
              LOCAL DWRESULT AS DWORD
              IF pthis = 0 THEN WbResult = %E_POINTER : EXIT FUNCTION
              CALL DWORD @@pthis[2] USING HtmlRelease(pthis) TO DWRESULT
              FUNCTION = DWRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ****************************************************************************************
          ' write method
          ' Writes one or more HTML expressions to a document in the specified window.
          ' Parameter:
          '    psarray
          '        [in] BSTR that specifies the text and HTML tags to write.
          ' Note: This function expects that you pass an unicode string in a safearray of variants.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLDocument2_write ( _
              BYVAL pthis AS DWORD PTR _                          ' %VT_DISPATCH <dispinterface>
            , ByVal psarray AS DWORD _                            ' %VT_SAFEARRAY [in]
              ) AS LONG                                           ' %VT_HRESULT <LONG>
          ' ****************************************************************************************
          SUB IHTMLDocument2_write (BYVAL pthis AS DWORD PTR, ByVal strScript AS STRING)
              LOCAL psarray AS DWORD, ix AS LONG, vScript AS VARIANT, rgsabound AS SAFEARRAYBOUND
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
              ' Create a safearray of variants of one element
              rgsabound.lLBound = 0 : rgsabound.cElements = 1
              psarray = SafeArrayCreate(%VT_VARIANT, 1, rgsabound)
              IF ISFALSE psarray THEN HtmlResult = %E_POINTER : EXIT SUB
              ' Fill the safearray with the script
              vScript = strScript : ix = 0
              SafeArrayPutElement(psarray, BYVAL VARPTR(ix), BYVAL VARPTR(vScript))
              ' Do the call
              CALL DWORD @@pthis[59] USING Proto_IHTMLDocument2_write(pthis, psarray) TO HtmlResult
              ' Destroy the safearray
              SafeArrayDestroy psarray
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' writeln method
          ' Writes one or more HTML expressions, followed by a carriage return, to a document in the
          ' specified window.
          ' Parameters
          '    psarray
          '        [in] BSTR that specifies the text and HTML tags to write.
          ' Return Value
          '    Returns %S_OK if successful, or an error value otherwise.
          ' Remarks
          '    In HTML, the carriage return is ignored unless it occurs within preformatted text.
          ' Note: This function expects that you pass an unicode string in a safearray of variants.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLDocument2_writeln ( _
              BYVAL pthis AS DWORD PTR _                          ' %VT_DISPATCH <dispinterface>
            , ByVal psarray AS DWORD _                            ' %VT_SAFEARRAY [in]
              ) AS LONG                                           ' %VT_HRESULT <LONG>
          ' ****************************************************************************************
          SUB IHTMLDocument2_writeln (BYVAL pthis AS DWORD PTR, ByVal strScript AS STRING)
              LOCAL psarray AS DWORD, ix AS LONG, vScript AS VARIANT, rgsabound AS SAFEARRAYBOUND
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
              ' Create a safearray of variants of one element
              rgsabound.lLBound = 0 : rgsabound.cElements = 1
              psarray = SafeArrayCreate(%VT_VARIANT, 1, rgsabound)
              IF ISFALSE psarray THEN HtmlResult = %E_POINTER : EXIT SUB
              ' Fill the safearray with the script
              vScript = strScript : ix = 0
              SafeArrayPutElement(psarray, BYVAL VARPTR(ix), BYVAL VARPTR(vScript))
              ' Do the call
              CALL DWORD @@pthis[60] USING Proto_IHTMLDocument2_writeln(pthis, psarray) TO HtmlResult
              ' Destroy the safearray
              SafeArrayDestroy psarray
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' close method
          ' Closes an output stream and forces the sent data to display.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLDocument2_close (BYVAL pthis AS DWORD PTR) AS LONG
          ' ****************************************************************************************
          SUB IHTMLDocument2_close (BYVAL pthis AS DWORD PTR)
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
              CALL DWORD @@pthis[62] USING Proto_IHTMLDocument2_close (pthis) TO HtmlResult
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' [get_]innerHTML property
          ' Retrieves the HTML between the start and end tags of the object.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLElement_get_innerHTML (BYVAL pthis AS DWORD PTR, ByRef p AS STRING) AS LONG
          ' ****************************************************************************************
          FUNCTION IHTMLElement_get_innerHTML (BYVAL pthis AS DWORD PTR) AS STRING
              LOCAL p AS STRING
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
              CALL DWORD @@pthis[58] USING Proto_IHTMLElement_get_innerHTML(pthis, p) TO HtmlResult
              FUNCTION = ACODE$(p)
          END FUNCTION
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' [put_]innerHTML property
          ' Interface name = IHTMLElement
          ' VTable offset = 228
          ' DispID = -2147417086 [&H80010402]
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLElement_put_innerHTML (BYVAL pthis AS DWORD PTR, ByVal p AS DWORD) AS LONG
          ' ****************************************************************************************
          SUB IHTMLElement_put_innerHTML (BYVAL pthis AS DWORD PTR, ByVal p AS STRING)
              p = UCODE$(p)
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
              CALL DWORD @@pthis[57] USING Proto_IHTMLElement_put_innerHTML(pthis, STRPTR(p)) TO HtmlResult
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' [get_]id property
          ' Retrieves the string identifying the object.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLElement_get_id (BYVAL pthis AS DWORD PTR, ByRef p AS STRING) AS LONG
          ' ****************************************************************************************
          FUNCTION IHTMLElement_get_id (BYVAL pthis AS DWORD PTR) AS STRING
              LOCAL p AS STRING
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
              CALL DWORD @@pthis[13] USING Proto_IHTMLElement_get_id(pthis, p) TO HtmlResult
              FUNCTION = ACODE$(p)
          END FUNCTION
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' [put_]id property
          ' Sets the string identifying the object.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLElement_put_id (BYVAL pthis AS DWORD PTR, BYVAL p AS DWORD) AS LONG
          ' ****************************************************************************************
          SUB IHTMLElement_put_id (BYVAL pthis AS DWORD PTR, BYVAL p AS STRING)
              p = UCODE$(p)
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
              CALL DWORD @@pthis[12] USING Proto_IHTMLElement_put_id(pthis, STRPTR(p)) TO HtmlResult
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' getElementById method
          ' Returns a reference to the first object with the specified value of the ID attribute.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLDocument3_getElementById (BYVAL pthis AS DWORD PTR, ByVal v AS STRING PTR, ByRef pel AS DWORD) AS LONG
          ' ****************************************************************************************
          FUNCTION IHTMLDocument3_getElementById (BYVAL pthis AS DWORD PTR, ByVal v AS STRING) AS DWORD
              LOCAL pel AS DWORD
              v = UCODE$(v)
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[46] USING Proto_IHTMLDocument3_getElementById(pthis, STRPTR(v), pel) TO HtmlResult
              FUNCTION = pel
          END FUNCTION
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' getAttribute method
          ' Retrieves the value of the specified attribute.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLElement_getAttribute (BYVAL pthis AS DWORD PTR, ByVal strAttributeName AS STRING PTR, ByVal lFlags AS LONG, ByRef AttributeValue AS VARIANT) AS LONG
          ' ****************************************************************************************
          SUB IHTMLElement_getAttribute (BYVAL pthis AS DWORD PTR, ByVal strAttributeName AS STRING, ByVal lFlags AS LONG, ByRef AttributeValue AS VARIANT)
              strAttributeName = UCODE$(strAttributeName)
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
              CALL DWORD @@pthis[8] USING Proto_IHTMLElement_getAttribute(pthis, STRPTR(strAttributeName), lFlags, AttributeValue) TO HtmlResult
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' setAttribute method
          ' Sets the value of the specified attribute.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLElement_setAttribute (BYVAL pthis AS DWORD PTR, BYVAL strAttributeName AS DWORD, BYVAL AttributeValue AS VARIANT, BYVAL lFlags AS LONG) AS LONG
          ' ****************************************************************************************
          SUB IHTMLElement_setAttribute (BYVAL pthis AS DWORD PTR, BYVAL strAttributeName AS STRING, BYVAL AttributeValue AS VARIANT, OPTIONAL ByRef lFlags AS LONG)
              LOCAL Flags AS LONG
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
              strAttributeName = UCODE$(strAttributeName)
              IF VARPTR(lFlags) THEN Flags = lFlags ELSE Flags = 1
              CALL DWORD @@pthis[7] USING Proto_IHTMLElement_setAttribute(pthis, STRPTR(strAttributeName), AttributeValue, Flags) TO HtmlResult
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' removeAttribute method
          ' Removes the given attribute from the object.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLElement_removeAttribute (BYVAL pthis AS DWORD PTR, BYVAL strAttributeName AS DWORD, BYVAL lFlags AS LONG, ByRef pfSuccess AS INTEGER) AS LONG
          ' ****************************************************************************************
          FUNCTION IHTMLElement_removeAttribute (BYVAL pthis AS DWORD PTR, BYVAL strAttributeName AS STRING, OPTIONAL BYREF lFlags AS LONG) AS INTEGER
              LOCAL pfSuccess AS INTEGER
              LOCAL Flags AS LONG
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
              strAttributeName = UCODE$(strAttributeName)
              IF VARPTR(lFlags) THEN Flags = lFlags ELSE Flags = 1
              CALL DWORD @@pthis[9] USING Proto_IHTMLElement_removeAttribute(pthis, STRPTR(strAttributeName), Flags, pfSuccess) TO HtmlResult
              FUNCTION = pfSuccess
          END FUNCTION
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' HTMLDocument_GetElementValueById
          ' Parameters:
          ' - pthis = Reference to the IHTMLDocument interface
          ' - strId = The value of the ID attribute
          ' Return Value:
          ' An string containing the value as ddefined by the attribute.
          ' This method performs a case insensitive property search.
          ' If two or more attributes have the same name (differing only in uppercase and lowercase
          ' letters) this function retrieves values only for the last attribute created with this
          ' name, and ignores all other attributes with the same name.
          ' When retrieving the CLASS attribute using this method, set the strAttributeName to be
          ' "className", which is the corresponding Dynamic HTML (DHTML) property.
          ' This function is used only by events created from HTML Components.
          ' HtmlResult will be filled with %S_OK if successful, or an error value otherwise.
          ' ****************************************************************************************
          FUNCTION HTMLDocument_GetElementValueById (BYVAL pthis AS DWORD, BYVAL strId AS STRING) AS STRING
          
             LOCAL ppDoc3 AS DWORD                ' // Reference to the IHTMLDocument3 interface
             LOCAL ppElement AS DWORD             ' // Reference to the element
             LOCAL IID_IHTMLDocument3 AS GUID     ' // IHTMLDocument3 interface identifier
             LOCAL pvar AS VARIANT                ' // General purpose variant
          
             IID_IHTMLDocument3 = GUID$("{3050F485-98B5-11CF-BB82-00AA00BDCE0B}")
             ' // Get a reference to the IHTMLDocument3 interface
             ppDoc3 = HtmlQueryInterface(pthis, IID_IHTMLDocument3)
             IF ppDoc3 THEN
                ' // Get a reference to the input element
                ppElement = IHTMLDocument3_getElementById(ppDoc3, strId)
                IF ppElement THEN
                   ' // Get the value
                   IHTMLElement_getAttribute ppElement, "value", 0, pvar
                   ' // Release the element interface
                   HtmlRelease ppElement
                END IF
                ' // Release the IHTMLDocument3 interface
                HtmlRelease ppDoc3
             END IF
          
             IF VARIANTVT(pvar) = %VT_BOOL THEN
                FUNCTION = LTRIM$(STR$(CINT(VARIANT#(pvar))))
             ELSEIF VARIANTVT(pvar) = %VT_BSTR THEN
                FUNCTION = VARIANT$(pvar)
             ELSE
                FUNCTION = LTRIM$(STR$(VARIANT#(pvar)))
             END IF
          
          END FUNCTION
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' HTMLDocument_SetElementValueById
          ' Parameters:
          ' - pthis = Reference to the IHTMLDocument interface
          ' - strId = The value of the ID attribute
          ' - varValue = Variant that specifies the string, number, or Boolean to assign to the attribute.
          ' HtmlResult will be filled with %S_OK if successful, or an error value otherwise.
          ' ****************************************************************************************
          SUB HTMLDocument_SetElementValueById (BYVAL pthis AS DWORD, BYVAL strId AS STRING, BYVAL varValue AS VARIANT)
          
             LOCAL ppDoc3 AS DWORD                ' // Reference to the IHTMLDocument3 interface
             LOCAL ppElement AS DWORD             ' // Reference to the element
             LOCAL IID_IHTMLDocument3 AS GUID     ' // IHTMLDocument3 interface identifier
          
             IID_IHTMLDocument3 = GUID$("{3050F485-98B5-11CF-BB82-00AA00BDCE0B}")
             ' // Get a reference to the IHTMLDocument3 interface
             ppDoc3 = HtmlQueryInterface(pthis, IID_IHTMLDocument3)
             IF ppDoc3 THEN
                ' // Get a reference to the input element
                ppElement = IHTMLDocument3_getElementById(ppDoc3, strId)
                IF ppElement THEN
                   ' // Set the value
                   IHTMLElement_setAttribute ppElement, "value", varValue, 0
                   ' // Release the element interface
                   HtmlRelease ppElement
                END IF
                ' // Release the IHTMLDocument3 interface
                HtmlRelease ppDoc3
             END IF
          
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' HTMLDocument_GetElementInnerHtmlById
          ' Parameters:
          ' - pthis = Reference to the IHTMLDocument interface
          ' - strId = The value of the ID attribute
          ' HtmlResult will be filled with %S_OK if successful, or an error value otherwise.
          ' ****************************************************************************************
          FUNCTION HTMLDocument_GetElementInnerHtmlById (BYVAL pthis AS DWORD, BYVAL strId AS STRING) AS STRING
          
             LOCAL ppDoc3 AS DWORD                ' // Reference to the IHTMLDocument3 interface
             LOCAL ppElement AS DWORD             ' // Reference to the element
             LOCAL IID_IHTMLDocument3 AS GUID     ' // IHTMLDocument3 interface identifier
             LOCAL strHtml AS STRING              ' // General purpose variable
          
             IID_IHTMLDocument3 = GUID$("{3050F485-98B5-11CF-BB82-00AA00BDCE0B}")
             ' // Get a reference to the IHTMLDocument3 interface
             ppDoc3 = HtmlQueryInterface(pthis, IID_IHTMLDocument3)
             IF ppDoc3 THEN
                ' // Get a reference to the input element
                ppElement = IHTMLDocument3_getElementById(ppDoc3, strId)
                IF ppElement THEN
                   ' // Get the inner html text
                   strHtml = IHTMLElement_get_innerHTML(ppElement)
                   FUNCTION = strHtml
                   ' // Release the element interface
                   HtmlRelease ppElement
                END IF
                ' // Release the IHTMLDocument3 interface
                HtmlRelease ppDoc3
             END IF
          
          END FUNCTION
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' HTMLDocument_SetElementInnerHtmlById
          ' Parameters:
          ' - pthis = Reference to the IHTMLDocument interface
          ' - strId = The value of the ID attribute
          ' HtmlResult will be filled with %S_OK if successful, or an error value otherwise.
          ' ****************************************************************************************
          SUB HTMLDocument_SetElementInnerHtmlById (BYVAL pthis AS DWORD, BYVAL strId AS STRING, BYVAL strHtml AS STRING)
          
             LOCAL ppDoc3 AS DWORD                ' // Reference to the IHTMLDocument3 interface
             LOCAL ppElement AS DWORD             ' // Reference to the element
             LOCAL IID_IHTMLDocument3 AS GUID     ' // IHTMLDocument3 interface identifier
             LOCAL pvar AS VARIANT                ' // General purpose variant
          
             IID_IHTMLDocument3 = GUID$("{3050F485-98B5-11CF-BB82-00AA00BDCE0B}")
             ' // Get a reference to the IHTMLDocument3 interface
             ppDoc3 = HtmlQueryInterface(pthis, IID_IHTMLDocument3)
             IF ppDoc3 THEN
                ' // Get a reference to the input element
                ppElement = IHTMLDocument3_getElementById(ppDoc3, strId)
                IF ppElement THEN
                   ' // Set the inner html text
                   IHTMLElement_put_innerHTML ppElement, strHtml
                   ' // Release the element interface
                   HtmlRelease ppElement
                END IF
                ' // Release the IHTMLDocument3 interface
                HtmlRelease ppDoc3
             END IF
          
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' [get_]activeElement property
          ' Retrieves the object that has the focus when the parent document has focus.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLDocument2_get_activeElement (BYVAL pthis AS DWORD PTR, ByRef p AS DWORD) AS LONG
          ' ****************************************************************************************
          FUNCTION IHTMLDocument2_get_activeElement (BYVAL pthis AS DWORD PTR) AS DWORD
              LOCAL p AS DWORD
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
              CALL DWORD @@pthis[10] USING Proto_IHTMLDocument2_get_activeElement(pthis, p) TO HtmlResult
              FUNCTION = p
          END FUNCTION
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' Retrieves the ID of the active element (the object that has the focus when the parent
          ' document has focus).
          ' pthis = Reference to the IHTMLDocument interface.
          ' ****************************************************************************************
          FUNCTION HTMLDocument_GetActiveElementId (BYVAL pthis AS DWORD PTR) AS STRING
             LOCAL ppElement AS DWORD
             ppElement = IHTMLDocument2_get_activeElement(pthis)
             FUNCTION = IHTMLElement_get_id(ppElement)
             HtmlRelease ppElement
          END FUNCTION
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' [get_]readyState property
          ' Retrieves a value that indicates the current state of the object.
          ' Possible values:
          ' uninitialized  Object is not initialized with data.
          ' loading        Object is loading its data.
          ' loaded         Object has finished loading its data.
          ' interactive    User can interact with the object even though it is not fully loaded.
          ' complete       Object is completely initialized.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLDocument2_get_readyState (BYVAL pthis AS DWORD PTR, ByRef p AS STRING) AS LONG
          ' ****************************************************************************************
          FUNCTION IHTMLDocument2_get_readyState (BYVAL pthis AS DWORD PTR) AS STRING
              LOCAL p AS STRING
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
              CALL DWORD @@pthis[22] USING Proto_IHTMLDocument2_get_readyState(pthis, p) TO HtmlResult
              FUNCTION = ACODE$(p)
          END FUNCTION
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' click method
          ' Simulates a click by causing the onclick event to fire.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLElement_click (BYVAL pthis AS DWORD PTR) AS LONG
          ' ****************************************************************************************
          SUB IHTMLElement_click (BYVAL pthis AS DWORD PTR)
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
              CALL DWORD @@pthis[69] USING Proto_IHTMLElement_click (pthis) TO HtmlResult
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' elementFromPoint method
          ' Returns the element for the specified x and y coordinates.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLDocument2_elementFromPoint (BYVAL pthis AS DWORD PTR, ByVal x AS LONG, ByVal y AS LONG, ByRef elementHit AS DWORD) AS LONG
          ' ****************************************************************************************
          FUNCTION IHTMLDocument2_elementFromPoint (BYVAL pthis AS DWORD PTR, ByVal x AS LONG, ByVal y AS LONG) AS DWORD
              LOCAL elementHit AS DWORD
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
              CALL DWORD @@pthis[107] USING Proto_IHTMLDocument2_elementFromPoint(pthis, x, y, elementHit) TO HtmlResult
              FUNCTION = elementHit
          END FUNCTION
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' focus method
          ' Causes the element to receive the focus and executes the code specified by the onfocus event.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLElement2_focus (BYVAL pthis AS DWORD PTR) AS LONG
          ' ****************************************************************************************
          SUB IHTMLElement2_focus (BYVAL pthis AS DWORD PTR)
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT SUB
              CALL DWORD @@pthis[50] USING Proto_IHTMLElement2_focus (pthis) TO HtmlResult
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' Sets the focus in the specified element.
          ' pthis = Reference to the IHTMLDocument interface.
          ' strId = Udentifier of the element.
          ' ****************************************************************************************
          SUB HTMLDocument_SetElementFocusById (BYVAL pthis AS DWORD, BYVAL strId AS STRING)
          
             LOCAL ppDoc3 AS DWORD                ' // Reference to the IHTMLDocument3 interface
             LOCAL ppElement AS DWORD             ' // Reference to the element
             LOCAL ppElement2 AS DWORD            ' // Reference to the element
             LOCAL IID_IHTMLDocument3 AS GUID     ' // IHTMLDocument3 interface identifier
             LOCAL IID_IHTMLElement2 AS GUID      ' // IHTMLElement2 interface identifier
          
             IID_IHTMLDocument3 = GUID$("{3050F485-98B5-11CF-BB82-00AA00BDCE0B}")
             IID_IHTMLElement2 = GUID$("{3050F434-98B5-11CF-BB82-00AA00BDCE0B}")
             ' // Get a reference to the IHTMLDocument3 interface
             ppDoc3 = HtmlQueryInterface(pthis, IID_IHTMLDocument3)
             IF ppDoc3 THEN
                ' // Get a reference to the input element
                ppElement = IHTMLDocument3_getElementById(ppDoc3, strId)
                IF ppElement THEN
                   ' // Get a reference to the IHTMLElement2 interface
                   ppElement2 = HtmlQueryInterface(ppElement, IID_IHTMLElement2)
                   IF ppElement2 THEN
                      ' // Set the focus in the element
                      IHTMLElement2_focus ppElement2
                      ' // Release the element interface
                      HtmlRelease ppElement2
                   END IF
                   ' // Release the element interface
                   HtmlRelease ppElement
                END IF
                ' // Release the IHTMLDocument3 interface
                HtmlRelease ppDoc3
             END IF
          
          END SUB
          ' ****************************************************************************************
          
          ' ****************************************************************************************
          ' [get_]parentWindow property
          ' Retrieves a reference to the container object of the window.
          ' ****************************************************************************************
          DECLARE FUNCTION Proto_IHTMLDocument2_get_parentWindow (BYVAL pthis AS DWORD PTR, ByRef p AS DWORD) AS LONG
          ' ****************************************************************************************
          FUNCTION IHTMLDocument2_get_parentWindow (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD
              LOCAL p AS DWORD
              IF ISFALSE pthis THEN HtmlResult = %E_POINTER : EXIT FUNCTION
              CALL DWORD @@pthis[108] USING Proto_IHTMLDocument2_get_parentWindow(pthis, p) TO HtmlResult
              FUNCTION = p
          END FUNCTION
          ' ****************************************************************************************
          
          ' ========================================================================================
          ' Identifiers
          ' ========================================================================================
          ' Form1
          %IDD_FORM1                                  = 100
          %IDC_FORM1_STATUSBAR1                       = 101
          %IDC_FORM1_REBAR1                           = 102
          %IDC_FORM1_WEBBROWSER1                      = 103
          %IDC_FORM1_TOOLBAR1                         = 104
          %IDC_FORM1_EDITURL                          = 105
          %IDC_FORM1_GOBTN                            = 106
          
          ' Rebar1
          %IDS_STRING0                                = 32770
          %IDS_STRING1                                = 32771
          %IDS_STRING2                                = 32772
          
          ' Command
          %IDM_GOBACK                                 = 28000
          %IDM_GOFORWARD                              = 28001
          %IDM_FIND                                   = 28002
          %IDM_PRINTPREVIEW                           = 28003
          %IDM_PRINT                                  = 28004
          %IDM_PROPERTIES                             = 28005
          %IDM_FILE_SAVE                              = 28006
          %IDM_PAGESETUP                              = 28007
          
          ' ========================================================================================
          ' Globals
          ' ========================================================================================
          GLOBAL  ghInstance              AS DWORD    ' handle of the application instance
          
          GLOBAL  gdwADM_ALIGNCONTROLS    AS DWORD    ' identifier of registered message
          ' Purpose: sent to a form or panel to reposition controls with alignment
          '          styles after the form or panel has been resized or scrolled.
          ' wParam:  N/A
          ' lParam:  the low-order word is the width, and the high-order word the height of the client area
          ' Return:  N/A
          
          GLOBAL  gdwADM_REALIGNPARTS     AS DWORD    ' identifier of registered message
          ' Purpose: posted by the parent of a status bar control to realign
          '          the status bar panels.
          ' wParam:  handle of parent of statusbar
          ' lParam:  handle of statusbar
          ' Return:  N/A
          GLOBAL  gdwCookie               AS DWORD    ' events cookie
          ' ========================================================================================
          
          ' ========================================================================================
          ' PROCEDURE: phnxAdjustWindowRect
          ' PURPOSE:   Adjusts the bounding rectangle of a nonresizeable window, based
          '            on the desired size of the client area, when a system parameter
          '            changes.
          ' ========================================================================================
          FUNCTION phnxAdjustWindowRect _
            ( _
            BYVAL hWnd      AS DWORD, _ ' window handle
            BYVAL cxClient  AS LONG, _  ' desired width of client area in pixels
            BYVAL cyClient  AS LONG _   ' desired height of client area in pixels
            ) AS LONG
          
            LOCAL trc     AS RECT
            LOCAL trcTemp AS RECT
            LOCAL hMenu   AS DWORD
            LOCAL dwStyle AS DWORD
            LOCAL cx      AS LONG
            LOCAL cy      AS LONG
          
            ' Calculate the height of the window taking menu wrap into account
            trc.nLeft   = 0
            trc.nTop    = 0
            trc.nRight  = cxClient
            trc.nBottom = cyClient
            hMenu   = GetMenu(hWnd)
            dwStyle = GetWindowLong(hWnd, %GWL_STYLE)
            AdjustWindowRectEx trc, dwStyle, (hMenu <> %NULL), GetWindowLong(hWnd, %GWL_EXSTYLE)
            ' If there is a menu, check how much wrapping occurs when we set the window
            ' to the width specified by AdjustWindowRect and an infinite amount of height.
            ' An infinite height allows us to see every single menu wrap.
            IF ISTRUE hMenu THEN
              trcTemp = trc
              trcTemp.nBottom = &H7FFF  ' "Infinite" height
              SendMessage hWnd, %WM_NCCALCSIZE, %FALSE, BYVAL VARPTR(trcTemp)
              ' Adjust our previous calculation to compensate for menu wrapping.
              trc.nBottom = trc.nBottom + trcTemp.nTop
            END IF
            ' AdjustWindowRectEx does not take the standard scrollbars into account
            IF (dwStyle AND %WS_HSCROLL) = %WS_HSCROLL THEN
              trc.nBottom = trc.nBottom + GetSystemMetrics(%SM_CYHSCROLL)
            END IF
            IF (dwStyle AND %WS_VSCROLL) = %WS_VSCROLL THEN
              trc.nRight = trc.nRight + GetSystemMetrics(%SM_CXVSCROLL)
            END IF
            cx = trc.nRight - trc.nLeft
            cy = trc.nBottom - trc.nTop
            SetWindowPos hWnd, %NULL, 0, 0, cx, cy, %SWP_NOZORDER OR %SWP_NOMOVE OR %SWP_NOACTIVATE
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: phnxCenterWindow
          ' PURPOSE:   Centers one window over another.  It also ensures that the
          '            placement is within the 'working area', meaning that it is
          '            both within the display limits of the screen, -and- not
          '            obscured by the tray or other frameing elements of the
          '            desktop.
          ' ========================================================================================
          FUNCTION phnxCenterWindow _
            ( _
            BYVAL hWndChild   AS DWORD, _ ' handle of window to center
            BYVAL hWndParent  AS DWORD _  ' handle of reference window or NULL if window is the screen
            ) AS LONG
          
            LOCAL trcChild      AS RECT     ' Child window dimensions
            LOCAL trcParent     AS RECT     ' Parent window dimensions
            LOCAL trcWorkArea   AS RECT     ' Work area dimensions
            LOCAL tpt           AS POINTAPI ' x and y coordinate of centered window
            LOCAL cxChild       AS LONG     ' Width of child window
            LOCAL cyChild       AS LONG     ' Height of child window
            LOCAL cxParent      AS LONG     ' Width of parent window
            LOCAL cyParent      AS LONG     ' Height of parent window
            LOCAL fResult       AS LONG     ' Return flag for SystemParametersInfo()
          
            ' Get the Height and Width of the child window
            GetWindowRect hWndChild, trcChild
            cxChild = trcChild.nRight - trcChild.nLeft
            cyChild = trcChild.nBottom - trcChild.nTop
          
            ' Get the limits of the 'workarea'
            fResult = SystemParametersInfo(%SPI_GETWORKAREA, SIZEOF(trcWorkArea), BYVAL VARPTR(trcWorkArea), 0)
            IF ISFALSE(fResult) THEN
              trcWorkArea.nLeft   = 0
              trcWorkArea.nTop    = 0
              trcWorkArea.nRight  = GetSystemMetrics(%SM_CXSCREEN)
              trcWorkArea.nBottom = GetSystemMetrics(%SM_CYSCREEN)
            END IF
          
            ' Get the Height and Width of the parent window
            IF ISTRUE hWndParent THEN
              GetWindowRect hWndParent, trcParent
            ELSE
              trcParent.nLeft   = trcWorkArea.nLeft
              trcParent.nTop    = trcWorkArea.nTop
              trcParent.nRight  = trcWorkArea.nRight
              trcParent.nBottom = trcWorkArea.nBottom
            END IF
            cxParent = trcParent.nRight - trcParent.nLeft
            cyParent = trcParent.nBottom - trcParent.nTop
          
            ' Calculate new X position, then adjust for workarea
            tpt.x = trcParent.nLeft + ((cxParent - cxChild) \ 2)
            IF (tpt.x < trcWorkArea.nLeft) THEN
              tpt.x = trcWorkArea.nLeft
              ELSEIF ((tpt.x + cxChild) > trcWorkArea.nRight) THEN
                tpt.x = trcWorkArea.nRight - cxChild
            END IF
          
            ' Calculate new Y position, then adjust for workarea
            tpt.y = trcParent.nTop  + ((cyParent - cyChild) \ 2)
            IF (tpt.y < trcWorkArea.nTop) THEN
              tpt.y = trcWorkArea.nTop
              ELSEIF ((tpt.y + cyChild) > trcWorkArea.nBottom) THEN
                tpt.y = trcWorkArea.nBottom - cyChild
            END IF
          
            IF (GetWindowLong(hWndChild, %GWL_STYLE) AND %WS_CHILD) = %WS_CHILD THEN
              ScreenToClient hWndParent, tpt
            END IF
          
            ' Reposition the window
            FUNCTION = SetWindowPos(hWndChild, %NULL, tpt.x, tpt.y, 0, 0, %SWP_NOSIZE OR %SWP_NOZORDER)
          
          END FUNCTION
          
          ' ========================================================================================
          ' FUNCTION: phnxGetFormHandle
          ' PURPOSE:  Finds the handle of the top-level window or MDI child
          '           window that is the ancestor of the specified window.  The
          '           reference handle is the handle of any control on the form.
          ' RETURNS:  The handle of the form.
          ' ========================================================================================
          
          FUNCTION phnxGetFormHandle _
            ( _
            BYVAL hWnd  AS DWORD _  ' reference handle
            ) AS DWORD
          
            WHILE ISTRUE (GetWindowLong(hWnd, %GWL_STYLE) AND %WS_CHILD)
              IF ISTRUE (GetWindowLong(hWnd, %GWL_EXSTYLE) AND %WS_EX_MDICHILD) THEN EXIT LOOP
              hWnd = GetParent(hWnd)
            WEND
          
            FUNCTION = hWnd
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: RealignStatusPanels
          ' PURPOSE:   Realigns the panels and embedded controls of the specified
          '            statusbar when the control is resized.
          ' ========================================================================================
          
          FUNCTION RealignStatusPanels _
            ( _
            BYVAL hWndParent  AS DWORD, _ ' handle of original parent
            BYVAL hWndStatus  AS DWORD, _ ' handle of statusbar
            BYVAL lOffsetPart AS LONG _   ' TRUE = offset last panel from size grip
            ) AS LONG
          
            LOCAL trc           AS RECT
            LOCAL plEdge        AS LONG PTR             ' address of array of right edges
            LOCAL plInfo        AS LONG PTR
            LOCAL hWndChild     AS DWORD                ' handle of child window
            LOCAL lNumParts     AS LONG
            LOCAL lPartIdx      AS LONG
            LOCAL dx            AS LONG
            DIM   cxBorder(2)   AS LONG
          
            ' Allocate memory for the coordinate of the right edge of each panel
            plEdge = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, 256 * 4)
            IF ISTRUE plEdge THEN
              lNumParts = SendMessage(hWndStatus, %SB_GETPARTS, 0, BYVAL 0)
              IF lNumParts > 0 THEN
                ' Get the right edge of each panel
                SendMessage hWndStatus, %SB_GETPARTS, lNumParts, BYVAL plEdge
                ' Get the spacing between panel
                ' The inter-panel spacing is in cxBorder(2)
                SendMessage hWndStatus, %SB_GETBORDERS, 0, BYVAL VARPTR(cxBorder(0))
                ' Calculate the change in the position of the right edges
                GetClientRect hWndStatus, trc
                dx = trc.nRight - cxBorder(2) - @plEdge[lNumParts - 1]
                IF ISTRUE lOffsetPart THEN
                  IF (GetWindowLong(hWndStatus, %GWL_STYLE) AND %SBARS_SIZEGRIP) = %SBARS_SIZEGRIP THEN
                    IF ISFALSE IsZoomed(hWndParent) THEN dx = dx - GetSystemMetrics(%SM_CXVSCROLL)
                  END IF
                END IF
                lPartIdx = 0
          
                DO UNTIL lPartIdx >= lNumParts
                  @plEdge[lPartIdx] = @plEdge[lPartIdx] + dx
                  INCR lPartIdx
                LOOP
          
                SendMessage hWndStatus, %SB_SETPARTS, lNumParts, BYVAL plEdge
                ' Realign embedded controls
                @plEdge[0] = hWndStatus
                @plEdge[1] = dx
                EnumChildWindows hWndStatus, CODEPTR(RealignStatus_ChildEnumProc), plEdge
              END IF
              ' Free memory that was allocated for the edge info
              HeapFree GetProcessHeap(), 0, BYVAL plEdge
            END IF
          
          END FUNCTION
          
          ' ========================================================================================
          '  TITLE: StatusBar_SetText
          '   DESC: Sets the text in the specified part of a status window.
          ' SYNTAX: StatusBar_SetText hStatus, iPart, sText
          ' Parameters:
          '   hStatus   - The handle of the Status Bar control.
          '   iPart     - Zero-based index of the part to set. If this value is 255,
          '               the status window is assumed to be a simple window having
          '               only one part.
          '   sText     - String that specifies the text to set.
          '   uType     - Type of drawing operation. This parameter can be one of the
          '               following:
          '
          ' Value          Meaning
          ' -------------- ----------------------------------------------------------
          ' 0              The text is drawn with a border to appear lower than the plane of the window.
          ' SBT_NOBORDERS  The text is drawn without borders.
          ' SBT_POPOUT     The text is drawn with a border to appear higher than the plane of the window.
          ' SBT_RTLREADING Displays text using right-to-left reading order on Hebrew or Arabic systems.
          '
          ' Return Values:
          '   If the operation succeeds, the return value is TRUE.
          '   If the operation fails, the return value is FALSE.
          '
          ' Remarks:
          '   The message invalidates the portion of the window that has changed, causing
          '   it to display the new text when the window next receives the WM_PAINT message.
          
          ' ========================================================================================
          
          FUNCTION StatusBar_SetText (BYVAL hStatus AS DWORD, BYVAL iPart AS DWORD, BYVAL strText AS STRING, OPT BYVAL uType AS DWORD) AS LONG
             FUNCTION = SendMessage (hStatus, %SB_SETTEXT, iPart OR uType, BYVAL STRPTR(strText))
          END FUNCTION
          
          ' ========================================================================================
          ' IOleCommandTarget_Exec method
          ' Executes a specified command or displays help for a command.
          ' ========================================================================================
          FUNCTION IOleCommandTarget_Exec (BYVAL pthis AS DWORD PTR, BYREF pguidCmdGroup AS GUID, BYVAL nCmdID AS DWORD, BYVAL nCmdexecopt AS DWORD, BYREF pvaIn AS VARIANT, BYREF pvaOut AS VARIANT) AS LONG
              LOCAL HRESULT AS LONG
              IF pthis = 0 THEN FUNCTION = %E_POINTER : EXIT FUNCTION
              CALL DWORD @@pthis[4] USING IOleCommandTarget_Exec(pthis, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ========================================================================================
          
          ' ========================================================================================
          ' Events code iclude file
          ' ========================================================================================
          #INCLUDE "IHTMLEventObj.inc"             ' IHTMLEventObj interface
          #INCLUDE "HTMLDocumentEvents2.inc"       ' HTMLDocument events
          #INCLUDE "DWebBrowserEvents2.inc"        ' WebBrowser events
          ' ========================================================================================
          
          ' ========================================================================================
          ' FUNCTION: RealignStatus_ChildEnumProc
          ' PURPOSE:  Enumerates all embedded controls in a statusbar.
          ' ========================================================================================
          
          FUNCTION RealignStatus_ChildEnumProc _
            ( _
            BYVAL hWnd    AS DWORD, _ ' handle of child window
            BYVAL lParam  AS LONG _   ' address of realignment info
            ) AS LONG
          
            LOCAL trc         AS RECT
            LOCAL plEdge      AS LONG PTR
            LOCAL hWndStatus  AS DWORD
            LOCAL dx          AS LONG
            LOCAL x           AS LONG
            LOCAL y           AS LONG
            LOCAL cy          AS LONG
          
            plEdge     = lParam
            hWndStatus = @plEdge[0]
            dx         = @plEdge[1]
          
            IF GetParent(hWnd) = hWndStatus THEN
              ' Get the bounding rectangle of the embedded control
              GetWindowRect hWnd, trc
              MapWindowPoints %NULL, hWndStatus, BYVAL VARPTR(trc), 2
              x  = trc.nLeft + dx
              cy = trc.nBottom - trc.nTop
              ' Get the bounding rectangle of any panel
              SendMessage hWndStatus, %SB_GETRECT, 0, BYVAL VARPTR(trc)
              y = (trc.nTop + trc.nBottom - cy) \ 2
              SetWindowPos hWnd, %NULL, x, y, 0, 0, %SWP_NOZORDER OR %SWP_NOSIZE OR %SWP_DRAWFRAME
            END IF
          
            FUNCTION = %TRUE
          
          END FUNCTION
          
          
          ' ========================================================================================
          ' PROCEDURE: Form1_InitWindow
          ' PURPOSE:   Initializes main window of this application instance.
          ' RETURN:    FALSE if initialization was successful, TRUE to close the window on
          '            failure.
          ' ========================================================================================
          
          FUNCTION Form1_InitWindow _
            ( _
            BYVAL hWnd    AS DWORD, _ ' handle of main window
            BYVAL lParam  AS LONG _   ' address of command line
            ) AS LONG
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_TranslateMessage
          ' PURPOSE:   Preprocesses messages.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_TranslateMessage _
            ( _
            BYVAL hWnd  AS DWORD, _   ' handle of window
                  tmsg  AS tagMsg _   ' message information
            ) AS LONG
          
            ' Retrieve the handle of the window that hosts the WebBrowser control
            LOCAL hCtrl AS DWORD
            hCtrl = GetDlgItem(hWnd, %IDC_FORM1_WEBBROWSER1)
            ' Retrieve the ancestor of the control that has the focus
            LOCAL hWndCtrl AS DWORD
            hWndCtrl = GetFocus
            DO
               IF ISFALSE GetParent(hWndCtrl) OR GetParent(hWndCtrl) = hWnd THEN EXIT DO
               hWndCtrl = GetParent(hWndCtrl)
            LOOP
          ' %WM_FORWARDMSG = &H37F
          ' If the focus is in the WebBrowser, forward the message to it
          '  IF hCtrl = GetParent(GetParent(GetParent(GetFocus))) THEN
            IF hCtrl = hWndCtrl THEN
               IF ISTRUE SendMessage(hCtrl, &H37F, 0, VARPTR(tmsg)) THEN FUNCTION = %TRUE
            END IF
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnClose
          ' PURPOSE:   Form1 WM_CLOSE message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnClose _
            ( _
            BYVAL hWnd  AS DWORD _  ' window handle
            ) AS LONG
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnCreate
          ' PURPOSE:   Form1 WM_CREATE message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnCreate _
            ( _
            BYVAL hWnd        AS DWORD, _ ' window handle
            BYVAL lptcs       AS DWORD, _ ' address of CREATESTRUCT structure
                  lMsgResult  AS LONG _   ' value returned to message
            ) AS LONG
          
            LOCAL hr AS LONG
            LOCAL hCtrl AS DWORD
            LOCAL ppvObj AS DWORD
            LOCAL dwCookie AS DWORD
            LOCAL ppDoc AS DWORD
            LOCAL vUrl AS VARIANT
            LOCAL vScript AS STRING
            LOCAL s AS STRING
          
            ' Get the handle of the window that hosts the webbrowser
            hCtrl = GetDlgItem(hWnd, %IDC_FORM1_WEBBROWSER1)
            IF ISFALSE hCtrl THEN EXIT FUNCTION
            ' Get the IDispatch of the control
            ppvObj = WbGetInterfacePointer(hCtrl)
            IF ISFALSE ppvObj THEN EXIT FUNCTION
            ' Connect to the events fired by the control
            hr = DWebBrowserEvents2_ConnectEvents(ppvObj, dwCookie)
            ' Store the cookie in the control properties
            SetProp hCtrl, "COOKIE", dwCookie
          '  ' Call the GoHome method
          '  IWebBrowser2_GoHome ppvObj
            ' Call the Navigate2 method
            vUrl = "about:blank"
            IWebBrowser2_Navigate2 ppvObj, vUrl
          
            ' Make an Html form
            s = "<html>" & $CRLF
            s = s & "<head>" & $CRLF
            s = s & "  <title>WebGui</title>" & $CRLF
            s = s & "" & $CRLF
            s = s & "<style type=""text/css"">" & $CRLF
            s = s & "<!--" & $CRLF
            s = s & "" & $CRLF
            s = s & "#output" & $CRLF
            s = s & "{" & $CRLF
            s = s & "background: #FFFFCC;" & $CRLF
            s = s & "border: thin solid black;" & $CRLF
            s = s & "text-align: center;" & $CRLF
            s = s & "width: 300px;" & $CRLF
            s = s & "}" & $CRLF
            s = s & "-->" & $CRLF
            s = s & "</style>" & $CRLF
            s = s & "" & $CRLF
            s = s & "</head>" & $CRLF
            s = s & "<body>" & $CRLF
            s = s & "<input type =""Button"" id=""Button_1"" name=""Button_1"" value=""Button 1""><br />" & $CRLF
            s = s & "<input type =""Button"" id=""Button_2"" name=""Button_2"" value=""Button 2""><br />" & $CRLF
            s = s & "<input type =""Button"" id=""Button_3"" name=""Button_3"" value=""Button 3""><br />" & $CRLF
            s = s & "<input type =""Button"" id=""Button_4"" name=""Button_4"" value=""Button 4""><br />" & $CRLF
            s = s & "<br />" & $CRLF
            s = s & "<div id=""output"">" & $CRLF
            s = s & "Click a button" & $CRLF
            s = s & "</div>" & $CRLF
            s = s & "<br />" & $CRLF
            s = s & "<br />" & $CRLF
            s = s & "<input type=""Text"" id=""Input_Text"" name=""Input_Text"" value="""" size=40><br />" & $CRLF
            s = s & "<br />" & $CRLF
            s = s & "<input type =""Button"" id=""Button_GetText"" name=""Button_GetTex"" value=""Get text""><br />" & $CRLF
            s = s & "</body>" & $CRLF
            s = s & "</html>" & $CRLF
          
            ppDoc = IWebBrowser2_GetDocument(ppvObj)
            IF ppDoc THEN
               IHTMLDocument2_write ppDoc, s
               IHtmlDocument2_close ppDoc
               WbRelease ppDoc
            END IF
          
            ' Release the interface
            WbRelease ppvObj
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnDestroy
          ' PURPOSE:   Form1 WM_DESTROY message handler.
          ' ========================================================================================
          
          SUB Form1_OnDestroy _
            ( _
            BYVAL hWnd        AS DWORD, _ ' window handle
                  lMsgResult  AS LONG _   ' value returned to message
            )
          
            LOCAL hr AS LONG
            LOCAL hCtrl AS DWORD
            LOCAL ppvObj AS DWORD
            LOCAL dwCookie AS DWORD
          
            ' Get the handle of the window that hosts the webbrowser
            hCtrl = GetDlgItem(hWnd, %IDC_FORM1_WEBBROWSER1)
            IF ISFALSE hCtrl THEN EXIT SUB
            ' Get the IDispatch of the control
            ppvObj = WbGetInterfacePointer(hCtrl)
            IF ISFALSE ppvObj THEN EXIT SUB
            ' Retrieve the events cookie
            dwCookie = GetProp(hCtrl, "COOKIE")
            ' Disconnect events
            IF dwCookie THEN hr = DWebBrowserEvents2_DisconnectEvents(ppvObj, dwCookie)
            ' Remove the cookie from the control
            RemoveProp hCtrl, "COOKIE"
            ' Release the interface
            WbRelease ppvObj
          
          END SUB
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnQueryEndSession
          ' PURPOSE:   Form1 WM_QUERYENDSESSION message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnQueryEndSession _
            ( _
            BYVAL hWnd        AS DWORD, _ ' window handle
            BYVAL lSource     AS LONG, _  ' source of end-session request
            BYVAL fLogOff     AS LONG, _  ' logoff flag
                  lMsgResult  AS LONG _   ' value returned to message
            ) AS LONG
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnSize
          ' PURPOSE:   Form1 WM_SIZE message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnSize _
            ( _
            BYVAL hWnd      AS DWORD, _ ' window handle
            BYVAL lState    AS LONG, _  ' resizing state
            BYVAL cxClient  AS LONG, _  ' width of client area
            BYVAL cyClient  AS LONG _   ' height of client area
            ) AS LONG
          
            LOCAL hCtrl AS DWORD
            LOCAL rc AS RECT
            LOCAL sbh AS LONG
          
            ' Height of the statusbar
            hCtrl = GetDlgItem(hWnd, %IDC_FORM1_STATUSBAR1)
            GetClientRect hCtrl, rc
            sbh = rc.nBottom - rc.nTop
          
            hCtrl = GetDlgItem(hWnd, %IDC_FORM1_WEBBROWSER1)
            MoveWindow hCtrl, 0, 0, cxClient, cyClient - sbh, %TRUE
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnPaint
          ' PURPOSE:   Form1 WM_PAINT message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnPaint _
            ( _
            BYVAL hWnd  AS DWORD _  ' window handle
            ) AS LONG
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnCommand
          ' PURPOSE:   Form1 WM_COMMAND message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnCommand _
            ( _
            BYVAL hWnd        AS DWORD, _ ' window handle
            BYVAL lCtrlId     AS LONG, _  ' identifier of menu item, control, or accelerator
            BYVAL hWndCtrl    AS DWORD, _ ' handle of control
            BYVAL lNotifyCode AS LONG _   ' notification code
            ) AS LONG
          
            SELECT CASE lCtrlId
          '     CASE %IDCANCEL
          '        ' Send a message to close the application
          '        SendMessage hWnd, %WM_CLOSE, 0, 0
          '        FUNCTION = %TRUE
          '     CASE %IDOK
            END SELECT
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnNotify
          ' PURPOSE:   Form1 WM_NOTIFY message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnNotify _
            ( _
            BYVAL hWnd        AS DWORD, _ ' window handle
            BYVAL lCtrlId     AS LONG, _  ' control identifier
            BYVAL lptnmhdr    AS DWORD, _ ' address of NMHDR structure
                  lMsgResult  AS LONG _   ' value returned to message
            ) AS LONG
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnKillFocus
          ' PURPOSE:   Form1 WM_KILLFOCUS message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnKillFocus _
            ( _
            BYVAL hWnd          AS DWORD, _ ' window handle
            BYVAL hWndNewFocus  AS DWORD _  ' handle of window receiving focus
            ) AS LONG
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnSetFocus
          ' PURPOSE:   Form1 WM_SETFOCUS message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnSetFocus _
            ( _
            BYVAL hWnd          AS DWORD, _ ' window handle
            BYVAL hWndOldFocus  AS DWORD _  ' handle of window losing focus
            ) AS LONG
          
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnActivate
          ' PURPOSE:   Form1 WM_ACTIVATE message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnActivate _
            ( _
            BYVAL hWnd          AS DWORD, _ ' window handle
            BYVAL lState        AS LONG, _  ' activation state
            BYVAL hWndActDeact  AS DWORD, _ ' handle of window being activated/deactivated
            BYVAL fMinimized    AS LONG _   ' minimized flag
            ) AS LONG
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_OnSysCommand
          ' PURPOSE:   Form1 WM_SYSCOMMAND message handler.
          ' RETURN:    TRUE if message was processed, FALSE if it was not.
          ' ========================================================================================
          
          FUNCTION Form1_OnSysCommand _
            ( _
            BYVAL hWnd      AS DWORD, _ ' window handle
            BYVAL lCmdType  AS LONG, _  ' type of system command requested
            BYVAL x         AS LONG, _  ' horizontal postion of cursor
            BYVAL y         AS LONG _   ' vertical position of cursor
            ) AS LONG
          
             ' If user has clicked the x button, send a WM_CLOSE message
             IF (lCmdType AND &HFFF0) = %SC_CLOSE THEN
                SendMessage hWnd, %WM_CLOSE, 0, 0
                FUNCTION = %TRUE
             END IF
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Project1_InitApplication
          ' PURPOSE:   Registers window classes and loads dynamic link libraries.
          ' RETURN:    FALSE if initialization was successful, TRUE if it was not.
          ' ========================================================================================
          
          FUNCTION Project1_InitApplication _
            ( _
            BYVAL hInstance   AS DWORD, _       ' handle of current instance
            BYVAL pszCmdLine  AS DWORD _        ' address of command line
            ) AS LONG
          
           ' Initializes ATL
             AtlAxWinInit
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Project1_UnloadInstance
          ' PURPOSE:   Unloads dynamic link libraries and frees memory associated with
          '            this instance.
          ' ========================================================================================
          
          SUB Project1_UnloadInstance _
            ( _
            BYVAL hInstance AS DWORD _  ' handle of current instance
            )
          
          END SUB
          
          ' ========================================================================================
          ' PROCEDURE: WinMain
          ' PURPOSE:   Program entry point, calls initialization function, processes
          '            message loop.
          ' ========================================================================================
          
          FUNCTION WinMain _
            ( _
            BYVAL hInstance     AS DWORD, _       ' handle of current instance
            BYVAL hPrevInstance AS DWORD, _       ' handle of previous instance(not used in Win32)
            BYVAL pszCmdLine    AS ASCIIZ PTR, _  ' address of command line
            BYVAL nCmdShow      AS LONG _         ' show state of window
            ) AS LONG
          
            LOCAL szClassName     AS ASCIIZ * %MAX_PATH       ' class name
            LOCAL twcx            AS WNDCLASSEX               ' class information
            LOCAL tmsg            AS tagMsg                   ' message information
            LOCAL ticc            AS INIT_COMMON_CONTROLSEX   ' specifies common control classes to register
            LOCAL hWnd            AS DWORD                    ' handle of main window
            LOCAL hWndModeless    AS DWORD                    ' handle of the current active window
          
            ' Save the handle of the application instance
            ghInstance = hInstance
          
            ' Register the Form1 window
            szClassName        = "Form1_Class"
            twcx.cbSize        = SIZEOF(twcx)                               ' size of WNDCLASSEX structure
            twcx.style         = %CS_DBLCLKS                                ' class styles
            twcx.lpfnWndProc   = CODEPTR(Form1_WndProc)                     ' address of window procedure used by class
            twcx.cbClsExtra    = 0                                          ' extra class bytes
            twcx.cbWndExtra    = 0                                          ' extra window bytes
            twcx.hInstance     = ghInstance                                 ' instance of the process that is registering the window
            twcx.hIcon         = LoadIcon(%NULL, BYVAL %IDI_APPLICATION)    ' handle of class icon
            twcx.hCursor       = LoadCursor(%NULL, BYVAL %IDC_ARROW)        ' handle of class cursor
            twcx.hbrBackground = %COLOR_BTNFACE + 1                         ' brush used to fill background of window's client area
            twcx.lpszMenuName  = %NULL                                      ' resource identifier of the class menu
            twcx.lpszClassName = VARPTR(szClassName)                        ' class name
            twcx.hIconSm       = %NULL                                      ' handle of small icon shown in caption/system Taskbar
            IF ISFALSE RegisterClassEx(twcx) THEN
              FUNCTION = %TRUE
              EXIT FUNCTION
            END IF
          
            ' Load the common controls library and
            ' specify the classes to register.
            ticc.dwSize = SIZEOF(ticc)
            ticc.dwICC  = %ICC_BAR_CLASSES OR %ICC_COOL_CLASSES
            InitCommonControlsEx ticc
          
            ' Register custom messages
            gdwADM_ALIGNCONTROLS = RegisterWindowMessage("ADM_ALIGNCONTROLS")
            gdwADM_REALIGNPARTS  = RegisterWindowMessage("ADM_REALIGNPARTS")
          
            ' Perform extra application initialization
            IF ISTRUE Project1_InitApplication(hInstance, BYVAL pszCmdLine) THEN
              FUNCTION = %FALSE
              EXIT FUNCTION
            END IF
          
            ' Create the Form1 window
            hWnd = CreateWindowEx(%WS_EX_WINDOWEDGE, _                                          ' extended styles
                                  "Form1_Class", _                                              ' class name
                                  "WebGui example", _                                           ' caption
                                  %WS_OVERLAPPEDWINDOW OR %WS_VISIBLE, _                        ' window styles
                                  1, 100, _                                                     ' left, top
                                  500, 350, _                                                   ' width, height
                                  %NULL, %NULL, _                                               ' handle of owner, menu handle
                                  ghInstance, BYVAL %NULL)                                      ' handle of instance, creation parameters
            ' If window could not be created, return "failure"
            IF ISFALSE hWnd THEN
              FUNCTION = %FALSE
              EXIT FUNCTION
            END IF
          
            ' Adjust the size of the window so that it conforms
            ' to the specified size of the client area
            phnxAdjustWindowRect hWnd, 500, 350
          
            ' Initialize this instance of the window
            IF ISTRUE Form1_InitWindow(hWnd, BYVAL pszCmdLine) THEN
              SendMessage hWnd, %WM_CLOSE, 0, 0
              FUNCTION = %FALSE
              EXIT FUNCTION
            END IF
          
            ' Center the window relative to the screen
            phnxCenterWindow hWnd, %NULL
            ' Make the window visible; update its client area
            ShowWindow hWnd, nCmdShow
            UpdateWindow hWnd
          
            ' Main message loop of program.
            ' Acquire and dispatch messages until a WM_QUIT message is received.
            WHILE ISTRUE GetMessage(tmsg, BYVAL %NULL, 0, 0)
              IF ISFALSE Form1_TranslateMessage(hWnd, tmsg) THEN
                hWndModeless = phnxGetFormHandle(GetFocus())
                IF (ISFALSE hWndModeless) OR (ISFALSE IsDialogMessage(hWndModeless, tmsg)) THEN
                  TranslateMessage tmsg
                  DispatchMessage tmsg
                END IF
              END IF
            WEND
          
            ' Free memory and unload dlls associated with this instance
            Project1_UnloadInstance hInstance
          
            FUNCTION = tmsg.wParam
          
          END FUNCTION
          
          ' ========================================================================================
          ' PROCEDURE: Form1_WndProc
          ' PURPOSE:   Processes messages for the Form1 window.
          ' ========================================================================================
          
          FUNCTION Form1_WndProc _
            ( _
            BYVAL hWnd    AS DWORD, _ ' window handle
            BYVAL uMsg    AS DWORD, _ ' type of message
            BYVAL wParam  AS DWORD, _ ' first message parameter
            BYVAL lParam  AS LONG _   ' second message parameter
            ) EXPORT AS LONG
          
            LOCAL szItem        AS ASCIIZ * %MAX_PATH   ' working variable
            LOCAL trbi          AS REBARINFO            ' specifies attributes(imagelist) of the rebar control
            LOCAL trbbi         AS REBARBANDINFO        ' specifies or receives the attributes of a rebar band
            LOCAL ttbb          AS TBBUTTON             ' specifies or receives the attributes of a toolbar button
            LOCAL ttbab         AS TBADDBITMAP          ' specifies the images to add to a toolbar
            LOCAL ptnmhdr       AS NMHDR PTR            ' information about a notification message
            LOCAL ptttdi        AS NMTTDISPINFO PTR     ' tooltip notification message information
            LOCAL pttbb         AS TBBUTTON PTR         ' address of array of toolbar button info
            LOCAL plEdge        AS LONG PTR             ' address of array of right edges
            LOCAL hWndChild     AS DWORD                ' handle of child window
            LOCAL hWndRebar     AS DWORD                ' handle of rebar control
            LOCAL hFont         AS DWORD                ' handle of font used by form
            LOCAL lMsgResult    AS LONG                 ' value returned to message after message is processed
          
            SELECT CASE uMsg
              CASE %WM_COMMAND
          
                SELECT CASE LOWRD(wParam)
          
                  CASE ELSE
                    ' If the message was processed
                    IF ISTRUE Form1_OnCommand(hWnd, LOWRD(wParam), lParam, HIWRD(wParam)) THEN
                      FUNCTION = %FALSE
                      EXIT FUNCTION
                    END IF
                END SELECT
          
              CASE %WM_SYSCOLORCHANGE
                ' Forward this message to common controls so that they will
                ' be properly updated when the user changes the color settings.
                SendMessage GetDlgItem(hWnd, %IDC_FORM1_STATUSBAR1), %WM_SYSCOLORCHANGE, wParam, lParam
                SendMessage GetDlgItem(hWndRebar, %IDC_FORM1_TOOLBAR1), %WM_SYSCOLORCHANGE, wParam, lParam
          
              CASE %WM_ACTIVATE
                ' If the message was processed
                IF ISTRUE Form1_OnActivate(hWnd, LOWRD(wParam), lParam, HIWRD(wParam)) THEN
                  FUNCTION = %FALSE
                  EXIT FUNCTION
                END IF
                FUNCTION = %FALSE
                EXIT FUNCTION
          
              CASE %WM_SETFOCUS
                ' If the message was processed
                IF ISTRUE Form1_OnSetFocus(hWnd, wParam) THEN
                  FUNCTION = %FALSE
                  EXIT FUNCTION
                END IF
                ' Set the keyboard focus to the first control that is
                ' visible, not disabled, and has the WS_TABSTOP style
                SetFocus GetNextDlgTabItem(hWnd, %NULL, %FALSE)
          
              CASE %WM_KILLFOCUS
                ' If the message was processed
                IF ISTRUE Form1_OnKillFocus(hWnd, wParam) THEN
                  FUNCTION = %FALSE
                  EXIT FUNCTION
                END IF
          
              CASE %WM_CLOSE
                ' If the message was processed
                IF ISTRUE Form1_OnClose(hWnd) THEN
                  FUNCTION = %FALSE
                  EXIT FUNCTION
                END IF
          
              CASE %WM_QUERYENDSESSION
                ' If the message was processed
                IF ISTRUE Form1_OnQueryEndSession(hWnd, wParam, lParam, lMsgResult) THEN
                  FUNCTION = lMsgResult
                  EXIT FUNCTION
                END IF
          
              CASE %WM_DESTROY
                Form1_OnDestroy hWnd, lMsgResult
                PostQuitMessage lMsgResult
                FUNCTION = %FALSE
                EXIT FUNCTION
          
              CASE %WM_SIZE
                IF wParam <> %SIZE_MINIMIZED THEN
                  ' Update the size and position of aligned controls
                  SendMessage hWnd, gdwADM_ALIGNCONTROLS, wParam, lParam
                  ' Realign statusbar panels
                  PostMessage hWnd, gdwADM_REALIGNPARTS, hWnd, GetDlgItem(hWnd, %IDC_FORM1_STATUSBAR1)
                  ' If the message was processed
                  IF ISTRUE Form1_OnSize(hWnd, wParam, LOWRD(lParam), HIWRD(lParam)) THEN
                    FUNCTION = %FALSE
                    EXIT FUNCTION
                  END IF
                  FUNCTION = %FALSE
                  EXIT FUNCTION
                END IF
          
              CASE gdwADM_ALIGNCONTROLS
                ' Update the size and position of aligned controls
                hWndChild = GetDlgItem(hWnd, %IDC_FORM1_STATUSBAR1)
                SendMessage hWndChild, %WM_SIZE, wParam, lParam
                InvalidateRect hWndChild, BYVAL %NULL, %TRUE
                SendMessage GetDlgItem(hWnd, %IDC_FORM1_REBAR1), %WM_SIZE, wParam, lParam
                FUNCTION = %FALSE
                EXIT FUNCTION
          
              CASE gdwADM_REALIGNPARTS
                ' Realign the panels of statusbars
                RealignStatusPanels wParam, lParam, %TRUE
                InvalidateRect lParam, BYVAL %NULL, %TRUE
                FUNCTION = %FALSE
                EXIT FUNCTION
          
              CASE %WM_PAINT
                ' If the message was processed
                IF ISTRUE Form1_OnPaint(hWnd) THEN
                  FUNCTION = %FALSE
                  EXIT FUNCTION
                END IF
          
              CASE %WM_SYSCOMMAND
                ' If the message was processed
                IF ISTRUE Form1_OnSysCommand(hWnd, wParam, LOINT(lParam), HIINT(lParam)) THEN
                  FUNCTION = %FALSE
                  EXIT FUNCTION
                END IF
          
              CASE %WM_CREATE
                ' Create font used by container
                hFont = GetStockObject(%DEFAULT_GUI_FONT)
          
                ' Create the Statusbar1 statusbar control
                hWndChild = CreateWindowEx(%NULL, _                                             ' extended styles
                                           "msctls_statusbar32", _                              ' class name
                                           "", _                                                ' caption
                                           %WS_CHILD OR %WS_VISIBLE OR _                        ' window styles
                                           %CCS_BOTTOM OR %SBARS_SIZEGRIP, _                    ' class styles
                                           0, 347, _                                            ' left, top
                                           535, 23, _                                           ' width, height
                                           hWnd, %IDC_FORM1_STATUSBAR1, _                       ' handle of parent, control ID
                                           ghInstance, BYVAL %NULL)                             ' handle of instance, creation parameters
                SendMessage hWndChild, %WM_SETFONT, hFont, %TRUE
          
                ' Allocate memory for the coordinate of the right edge of each part
                plEdge = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, 1 * 4)
                IF ISTRUE plEdge THEN
                  @plEdge[0] = 96
                  SendMessage hWndChild, %SB_SETPARTS, 1, BYVAL plEdge
                  ' Free memory that was allocated for the edge info
                  HeapFree GetProcessHeap(), 0, BYVAL plEdge
                END IF
                ' Update the size of the statusbar
                SendMessage hWndChild, %WM_SIZE, 0, 0
          
                ' Create the WebBrowser control
                hWndChild = CreateWindowEx(%NULL, _                                             ' extended styles
                                           "AtlAxWin", _                                        ' class name
                                           "Shell.Explorer", _                                  ' caption
                                           %WS_CHILD OR %WS_VISIBLE OR %WS_CLIPSIBLINGS OR _    ' window styles
                                           %WS_TABSTOP, _
                                           0, 0, _                                              ' left, top
                                           0, 0, _                                              ' width, height
                                           hWnd, %IDC_FORM1_WEBBROWSER1, _                      ' handle of parent, control ID
                                           ghInstance, BYVAL %NULL)                             ' handle of instance, creation parameters
          
                ' If the message was processed
                IF ISTRUE Form1_OnCreate(hWnd, lParam, lMsgResult) THEN
                  FUNCTION = lMsgResult
                  EXIT FUNCTION
                END IF
                FUNCTION = %FALSE
                EXIT FUNCTION
            END SELECT
          
            FUNCTION = DefWindowProc(hWnd, uMsg, wParam, lParam)
          
          END FUNCTION
          ' ========================================================================================
          Last edited by José Roca; 30 Aug 2007, 06:52 PM.
          Forum: http://www.jose.it-berater.org/smfforum/index.php

          Comment

          Working...
          X