|
|
|
IPropertyNotifySink Interface |
|
IID_IPropertyNotifySink |
{9BFBBC02-EFF1-101A-84ED-00AA00341D07} |
|
The IPropertyNotifySink interface is implemented by a sink object to receive notifications about property changes from an object that supports IPropertyNotifySink as an "outgoing" interface. The client that needs to receive the notifications in this interface (from a supporting connectable object) creates a sink with this interface and connects it to the connectable object through the connection point mechanism. For more information on connection points, see IConnectionPointContainer.
The object is itself required to call the methods of IPropertyNotifySink only for those properties marked with the [bindable] and [requestedit] attributes in the object's type information. When the object changes a [bindable] property, it is required to call IPropertyNotifySink::OnChanged. When the object is about to change a [requestedit] property, it must call IPropertyNotifySink::OnRequestEdit before changing the property and must also honor the action specified by the sink on return from this call.
The one exception to this rule is that no notifications are sent as a result of an object's initialization or loading procedures. At initialization time, it is assumed that all properties change and that all must be allowed to change. Notifications to this interface are therefore meaningful only in the context of a fully initialized/loaded object.
|
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
IPropertyNotifySink Methods |
Description |
|
OnChanged |
Notifies a sink that a bindable property has changed. |
|
OnRequestEdit |
Notifies a sink that a requestedit property is about to change. |
|
OnChanged |
|
FUNCTION IPropertyNotifySink_OnChanged ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dispID AS LONG _ ) AS LONG
LOCAL HRESULT AS LONG
|
|
OnRequestEdit |
|
FUNCTION IPropertyNotifySink_OnRequestEdit ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dispID AS LONG _ ) AS LONG
LOCAL HRESULT AS LONG
|
|
IPropertyNotifySink interface implementation |
$IID_IPropertyNotifySink = GUID$("{9BFBBC02-EFF1-101A-84ED-00AA00341D07}")
' ****************************************************************************************
' IPropertyNotifySink interface
' ****************************************************************************************
TYPE IPropertyNotifySinkVtbl
' IUnknown methods
pQueryInterface AS DWORD ' // QueryInterface method
pAddRef AS DWORD ' // AddRef method
pRelease AS DWORD ' // Release method
' IPropertyNotifySink members
pRead AS DWORD ' // Read method
pWrite AS DWORD ' // Write method
pOnChanged AS DWORD ' // OnChanged method
pOnRequestEdit AS DWORD ' // OnRequestEdit method
' Custom data
pVtblAddr AS DWORD ' // Address of the virtual table
cRef AS DWORD ' // Reference count
END TYPE
' ****************************************************************************************
' ****************************************************************************************
' Builds the IPropertyNotifySink Virtual Table
' Returns a cookie that is a pointer to a IPropertyNotifySinkVtbl structure.
' ****************************************************************************************
FUNCTION IPropertyNotifySink_BuildVtbl () AS DWORD
LOCAL pVtbl AS IPropertyNotifySinkVtbl PTR
LOCAL pUnk AS IPropertyNotifySinkVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVtbl.pQueryInterface = CODEPTR(IPropertyNotifySink_QueryInterface)
@pVtbl.pAddRef = CODEPTR(IPropertyNotifySink_AddRef)
@pVtbl.pRelease = CODEPTR(IPropertyNotifySink_Release)
@pVtbl.pRead = CODEPTR(IPropertyNotifySink_Read)
@pVtbl.pWrite = CODEPTR(IPropertyNotifySink_Write)
@pVtbl.pOnChanged = CODEPTR(IPropertyNotifySink_OnChanged)
@pVtbl.pOnRequestEdit = CODEPTR(IPropertyNotifySink_OnRequestEdit)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.cRef = 1
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IPropertyNotifySink_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION IPropertyNotifySink_QueryInterface (BYVAL pCookie AS IPropertyNotifySinkVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
IF riid = $IID_IPropertyNotifySink THEN
ppvObj = pCookie
INCR @@pCookie.cRef
FUNCTION = %S_OK
ELSE
FUNCTION = %E_NOINTERFACE
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IPropertyNotifySink_AddRef method
' Increments the reference counter.
' ****************************************************************************************
FUNCTION IPropertyNotifySink_AddRef (BYVAL pCookie AS IPropertyNotifySinkVtbl PTR) AS DWORD
INCR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IPropertyNotifySink_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IPropertyNotifySink_Release (BYVAL pCookie AS IPropertyNotifySinkVtbl 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
' ****************************************************************************************
' ****************************************************************************************
' Notifies a sink that a bindable property has changed.
' ****************************************************************************************
FUNCTION IPropertyNotifySink_OnChanged (BYVAL pCookie AS IPropertyNotifySinkVtbl PTR, BYVAL dispID AS LONG) AS LONG
' Put your code here
' FUNCTION = %S_OK
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Notifies a sink that a requestedit property is about to change.
' ****************************************************************************************
FUNCTION IPropertyNotifySink_OnRequestEdit (BYVAL pCookie AS IPropertyNotifySinkVtbl PTR, BYVAL dispID AS LONG) AS LONG
' Put your code here
' FUNCTION = %S_OK
END FUNCTION
' ****************************************************************************************
|
Page last updated on Monday, 03 April 2006 20:26:49 +0200