Home COM GDI+ WebBrowser Data Access

IHTMLOMWindowServices Interface

 

SID_IHTMLOMWindowServices

{3050F5FC-98B5-11CF-BB82-00AA00BDCE0B}

IID_IHTMLOMWindowServices

{3050F5FC-98B5-11CF-BB82-00AA00BDCE0B}

 

 

Allows applications hosting the WebBrowser Control to intercept the window object calls moveTo, moveBy, resizeTo, and resizeBy for manipulating the host's window coordinates from Dynamic HTML (DHTML) script.

 

The IHTMLOMWindowServices interface was introduced in Internet Explorer 6 for Microsoft Windows XP Service Pack 2 (SP2).

 

Applications hosting the WebBrowser Control should implement this interface and IServiceProvider. Internet Explorer calls IServiceProvider::QueryService for SID_SHTMLOMWindowServices and IID_IHTMLOMWindowServices on the host's client site.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IHTMLOMWindowServices Members

Description

moveTo

Moves the screen position of the upper-left corner of the application's window to the specified coordinates.

moveBy

Moves the screen position of the application's window by the specified offset values.

resizeTo

Sets the size of the application's window to the specified values.

resizeBy

Changes the current size of the application's window by the specified offset values.

 

IHTMLOMWindowServices interface implementation

 


$IID_IHTMLOMWindowServices = GUID$("{3050F5FC-98B5-11CF-BB82-00AA00BDCE0B")

' ****************************************************************************************
' IHTMLOMWindowServices interface
' ****************************************************************************************
TYPE IHTMLOMWindowServicesVtbl
   ' IUnknown methods
   pQueryInterface          AS DWORD          ' // QueryInterface method
   pAddRef                  AS DWORD          ' // AddRef method
   pRelease                 AS DWORD          ' // Release method
   ' IHTMLOMWindowServices members
   pmoveTo                  AS DWORD          ' // moveTo method
   pmoveBy                  AS DWORD          ' // moveBy method
   presizeTo                AS DWORD          ' // resizeTo method
   presizeBy                AS DWORD          ' // resizeBy method
   ' Custom data
   pVtblAddr                AS DWORD          ' // Address of the virtual table
   cRef                     AS DWORD          ' // Reference count
END TYPE
' ****************************************************************************************

' ****************************************************************************************
' Builds the IHTMLOMWindowServices Virtual Table
' Returns a cookie that is a pointer to a IHTMLOMWindowServicesVtbl structure.
' ****************************************************************************************
FUNCTION IHTMLOMWindowServices_BuildVtbl () AS DWORD

   LOCAL pVtbl AS IHTMLOMWindowServicesVtbl PTR
   LOCAL pUnk AS IHTMLOMWindowServicesVtbl PTR

   pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
   IF pVtbl = 0 THEN EXIT FUNCTION

   @pVtbl.pQueryInterface          = CODEPTR(IHTMLOMWindowServices_QueryInterface)
   @pVtbl.pAddRef                  = CODEPTR(IHTMLOMWindowServices_AddRef)
   @pVtbl.pRelease                 = CODEPTR(IHTMLOMWindowServices_Release)

   @pVtbl.pmoveTo                  = CODEPTR(IHTMLOMWindowServices_moveTo)
   @pVtbl.pmoveBy                  = CODEPTR(IHTMLOMWindowServices_moveBy)
   @pVtbl.presizeTo                = CODEPTR(IHTMLOMWindowServices_resizeTo)
   @pVtbl.presizeBy                = CODEPTR(IHTMLOMWindowServices_resizeBy)

   @pVtbl.pVtblAddr                = pVtbl
   @pVtbl.cRef                     = 1

   pUnk = VARPTR(@pVtbl.pVtblAddr)
   FUNCTION = pUnk

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IHTMLOMWindowServices_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION IHTMLOMWindowServices_QueryInterface (BYVAL pCookie AS IHTMLOMWindowServicesVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
   IF riid = $IID_IHTMLOMWindowServices THEN
      ppvObj = pCookie
      INCR @@pCookie.cRef
      FUNCTION = %S_OK
   ELSE
      FUNCTION = %E_NOINTERFACE
   END IF
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IHTMLOMWindowServices_AddRef method
' Increments the reference counter.
' ****************************************************************************************
FUNCTION IHTMLOMWindowServices_AddRef (BYVAL pCookie AS IHTMLOMWindowServicesVtbl PTR) AS DWORD
   INCR @@pCookie.cRef
   FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IHTMLOMWindowServices_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IHTMLOMWindowServices_Release (BYVAL pCookie AS IHTMLOMWindowServicesVtbl PTR) AS DWORD
   DECR @@pCookie.cRef
   FUNCTION = @@pCookie.cRef
   IF @@pCookie.cRef = 0 THEN
      IF ISTRUE @@pCookie.pVtblAddr THEN
         HeapFree(GetProcessHeap(), 0, BYVAL @@pCookie.pVtblAddr)
      END IF
   END IF
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Moves the screen position of the upper-left corner of the application's window to the
' specified coordinates.
' ****************************************************************************************
FUNCTION IHTMLOMWindowServices_moveTo (BYVAL pCookie AS IHTMLOMWindowServicesVtbl PTR, BYVAL x AS LONG, BYVAL y AS LONG) AS LONG
   ' Put your code here
   ' FUNCTION = %S_OK, or %E_FAIL
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Moves the screen position of the application's window by the specified offset values.
' ****************************************************************************************
FUNCTION IHTMLOMWindowServices_moveBy (BYVAL pCookie AS IHTMLOMWindowServicesVtbl PTR, BYVAL x AS LONG, BYVAL y AS LONG) AS LONG
   ' Put your code here
   ' FUNCTION = %S_OK, or %E_FAIL
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Sets the size of the application's window to the specified values.
' ****************************************************************************************
FUNCTION IHTMLOMWindowServices_resizeTo (BYVAL pCookie AS IHTMLOMWindowServicesVtbl PTR, BYVAL x AS LONG, BYVAL y AS LONG) AS LONG
   ' Put your code here
   ' FUNCTION = %S_OK, or %E_FAIL
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Changes the current size of the application's window by the specified offset values.
' ****************************************************************************************
FUNCTION IHTMLOMWindowServices_resizeBy (BYVAL pCookie AS IHTMLOMWindowServicesVtbl PTR, BYVAL x AS LONG, BYVAL y AS LONG) AS LONG
   ' Put your code here
   ' FUNCTION = %S_OK, or %E_FAIL
END FUNCTION
' ****************************************************************************************
 

 

Page last updated on Monday, 03 April 2006 19:57:43 +0200