Home COM GDI+ WebBrowser Data Access

ITargetNotify Interface

 

IID_ITargetNotify

{863A99A0-21BC-11D0-82B4-00A0C90C29C5}

 

 

This interface provides methods to receive notifications about the creation of windows for new frames.
 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

ITargetNotify Members

Description

OnCreate

Occurs when a new window is created for a frame.

OnReuse

Occurs when a window is reloaded with a new frame.

 

ITargetNotify interface implementation

 


$IID_ITargetNotify = GUID$("{863a99a0-21bc-11d0-82b4-00a0c90c29c5}")

' ****************************************************************************************
' ITargetNotify interface virtual table
' ****************************************************************************************
TYPE ITargetNotifyVtbl
   ' IUnknown methods
   pQueryInterface         AS DWORD          ' // QueryInterface method
   pAddRef                 AS DWORD          ' // AddRef method
   pRelease                AS DWORD          ' // Release method
   ' ITargetNotify methods
   pOnCreate               AS DWORD          ' // OnCreate method
   pOnReuse                AS DWORD          ' // OnReuse method
   ' Custom data
   pVtblAddr               AS DWORD          ' // Address of the virtual table
   cRef                    AS DWORD          ' // Reference count
END TYPE
' ****************************************************************************************

' ****************************************************************************************
' Builds the ITargetNotify Virtual Table
' Returns a cookie that is a pointer to a ITargetNotifyVtbl structure.
' ****************************************************************************************
FUNCTION ITargetNotify_BuildVtbl () AS DWORD

   LOCAL pVtbl AS ITargetNotifyVtbl PTR
   LOCAL pUnk AS ITargetNotifyVtbl PTR

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

   @pVtbl.pQueryInterface         = CODEPTR(ITargetNotify_QueryInterface)
   @pVtbl.pAddRef                 = CODEPTR(ITargetNotify_AddRef)
   @pVtbl.pRelease                = CODEPTR(ITargetNotify_Release)

   @pVtbl.pOnCreate               = CODEPTR(ITargetNotify_OnCreate)
   @pVtbl.pOnReuse                = CODEPTR(ITargetNotify_OnReuse)

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

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

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

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

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

' ****************************************************************************************
' ITargetNotify_IUnknown_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION ITargetNotify_Release (BYVAL pCookie AS ITargetNotifyVtbl 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
' ****************************************************************************************

' ****************************************************************************************
' Occurs when a new window is created for a frame.
' ****************************************************************************************
FUNCTION  ITargetNotify_OnCreate (BYVAL pCookie AS ITargetNotifyVtbl PTR, BYVAL pUnkDestination AS DWORD, BYVAL cbCookie AS DWORD) AS LONG
   ' Put your code here
   ' FUNCTION = %S_OK
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Occurs when a window is reloaded with a new frame.
' ****************************************************************************************
FUNCTION  ITargetNotify_OnReuse (BYVAL pCookie AS ITargetNotifyVtbl PTR, BYVAL pUnkDestination AS DWORD) AS LONG
   ' Put your code here
   ' FUNCTION = %S_OK
END FUNCTION
' ****************************************************************************************
 

 

Page last updated on Monday, 03 April 2006 20:05:12 +0200