|
|
|
IRowsetNotify Interface |
|
IID_IRowsetNotify |
{0997A571-126E-11D0-9F8A-00A0C9A0631E} |
|
IRowsetNotify is the callback interface that a consumer must support to connect to local notifications provided by a rowset object. The notifications are intended to synchronize objects that are attached to the same rowset instance. The notifications do not reflect changes in underlying shared tables that occur through other programs or users.
Documentation: IRowsetNotify
|
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
IRowsetNotify Method |
Description |
|
OnFieldChange |
Notifies the consumer of any change to the value of a column. |
|
OnRowChange |
Notifies the consumer of the first change to a row or of any change that affects the entire row. |
|
OnRowsetChange |
Notifies the consumer of any change affecting the entire rowset. |
|
IRowsetNotify interface implementation |
$IID_IRowsetNotify = GUID$("{0C733A83-2A1C-11CE-ADE5-00AA0044773D")
' ****************************************************************************************
' IRowsetNotify interface
' ****************************************************************************************
TYPE IRowsetNotifyVtbl
' IUnknown methods
pQueryInterface AS DWORD ' // QueryInterface method
pAddRef AS DWORD ' // AddRef method
pRelease AS DWORD ' // Release method
' IRowsetNotify members
pOnFieldChange AS DWORD ' // OnFieldChange method
pOnRowChange AS DWORD ' // OnRowChange method
pOnRowsetChange AS DWORD ' // OnRowsetChange method
' Custom data
pVtblAddr AS DWORD ' // Address of the virtual table
cRef AS DWORD ' // Reference count
pthis AS DWORD ' // IUnknown of the control that fires the events
END TYPE
' ****************************************************************************************
' ****************************************************************************************
' Builds the IRowsetNotify Virtual Table
' Returns a cookie that is a pointer to a IRowsetNotifyVtbl structure.
' ****************************************************************************************
FUNCTION IRowsetNotify_BuildVtbl (BYVAL pthis AS DWORD) AS DWORD
LOCAL pVtbl AS IRowsetNotifyVtbl PTR
LOCAL pUnk AS IRowsetNotifyVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVtbl.pQueryInterface = CODEPTR(IRowsetNotify_QueryInterface)
@pVtbl.pAddRef = CODEPTR(IRowsetNotify_AddRef)
@pVtbl.pRelease = CODEPTR(IRowsetNotify_Release)
@pVtbl.pOnFieldChange = CODEPTR(IRowsetNotify_OnFieldChange)
@pVtbl.pOnRowChange = CODEPTR(IRowsetNotify_OnRowChange)
@pVtbl.pOnRowsetChange = CODEPTR(IRowsetNotify_OnRowsetChange)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.pthis = pthis
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Returns a pointer to a specified interface on an object to which a client currently holds an
' interface pointer.
' ****************************************************************************************
FUNCTION IRowsetNotifyEvents_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 IRowsetNotifyEvents_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 IRowsetNotifyEvents_Release (BYVAL pthis AS DWORD PTR) AS DWORD
LOCAL HRESULT AS DWORD
CALL DWORD @@pthis[2] USING IRowsetNotifyEvents_Release(pthis) TO HRESULT
FUNCTION = HRESULT
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 IRowsetNotifyEvents_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 IRowsetNotifyEvents_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 IRowsetNotifyEvents_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 IRowsetNotifyEvents_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 IRowsetNotifyEvents_IConnectionPoint_Unadvise (BYVAL pthis AS DWORD PTR, BYVAL dwCookie AS DWORD) AS LONG
LOCAL HRESULT AS LONG
CALL DWORD @@pthis[6] USING IRowsetNotifyEvents_IConnectionPoint_Unadvise(pthis, dwCookie) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ******************************************************************************************
' UI4 AddRef()
' ******************************************************************************************
FUNCTION IRowsetNotify_AddRef (BYVAL pCookie AS IRowsetNotifyVtbl PTR) AS DWORD
INCR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ******************************************************************************************
' ******************************************************************************************
' HRESULT QueryInterface([in] *GUID riid, [out] **VOID ppvObj)
' ******************************************************************************************
FUNCTION IRowsetNotify_QueryInterface (BYVAL pCookie AS IRowsetNotifyVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
IF riid = $IID_IRowsetNotify THEN
ppvObj = pCookie
IRowsetNotify_AddRef pCookie
FUNCTION = %S_OK
ELSE
FUNCTION = %E_NOINTERFACE
END IF
END FUNCTION
' ******************************************************************************************
' ******************************************************************************************
' UI4 Release()
' ******************************************************************************************
FUNCTION IRowsetNotify_Release (BYVAL pCookie AS IRowsetNotifyVtbl PTR) AS DWORD
LOCAL pVtblAddr AS DWORD
IF @@pCookie.cRef = 1 THEN
pVtblAddr = @@pCookie.pVtblAddr
IF ISTRUE HeapFree(GetProcessHeap(), 0, BYVAL pVtblAddr) THEN
FUNCTION = 0
EXIT FUNCTION
ELSE
FUNCTION = @@pCookie.cRef
EXIT FUNCTION
END IF
END IF
DECR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ******************************************************************************************
' ****************************************************************************************
' Notifies the consumer of any change to the value of a column.
' ****************************************************************************************
FUNCTION IRowsetNotify_OnFieldChange (BYVAL pCookie AS IRowsetNotifyVtbl PTR, BYVAL pRowset AS DWORD, BYVAL hRow AS DWORD, BYVAL cColumns AS DWORD, _
BYVAL rgColumns AS DWORD, BYVAL eReason AS DWORD, BYVAL ePhase AS DWORD, BYVAL fCantDeny AS LONG) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Notifies the consumer of the first change to a row or of any change that affects the entire row.
' ****************************************************************************************
FUNCTION IRowsetNotify_OnRowChange (BYVAL pCookie AS IRowsetNotifyVtbl PTR, BYVAL pRowset AS DWORD, BYVAL cRows AS DWORD, _
BYVAL rghRows AS DWORD, BYVAL eReason AS DWORD, BYVAL ePhase AS DWORD, BYVAL fCantDeny AS LONG) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Notifies the consumer of any change affecting the entire rowset.
' ****************************************************************************************
FUNCTION IRowsetNotify_OnRowsetChange (BYVAL pCookie AS IRowsetNotifyVtbl PTR, BYVAL pRowset AS DWORD, BYVAL eReason AS DWORD, BYVAL ePhase AS DWORD, BYVAL fCantDeny AS LONG) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Establishes a connection between the connection point object and the client's sink.
' Returns a token that uniquely identifies this connection.
' ****************************************************************************************
FUNCTION IRowsetNotify_ConnectEvents (BYVAL pthis AS DWORD, BYREF pdwCookie AS DWORD) AS LONG
LOCAL HRESULT AS DWORD ' 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 = $IID_IRowsetNotify
IF pthis = 0 THEN FUNCTION = -1 : EXIT FUNCTION
HRESULT = IRowsetNotifyEvents_QueryInterface(pthis, IID_CPC, pCPC)
IF HRESULT <> 0 THEN FUNCTION = HRESULT : EXIT FUNCTION
HRESULT = IRowsetNotifyEvents_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
IRowsetNotifyEvents_Release pCPC
IF HRESULT <> 0 THEN FUNCTION = HRESULT : EXIT FUNCTION
pUnkSink = IRowsetNotify_BuildVtbl(pthis)
IF ISTRUE pUnkSink THEN HRESULT = IRowsetNotifyEvents_IConnectionPoint_Advise(pCP, pUnkSink, dwCookie)
IRowsetNotifyEvents_Release pCP
pdwCookie = dwCookie
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Releases the events connection identified with the cookie returned by the ConnectEvents function
' ****************************************************************************************
FUNCTION IRowsetNotify_DisconnectEvents (BYVAL pthis AS DWORD, BYVAL dwCookie AS DWORD) AS LONG
LOCAL HRESULT AS DWORD ' 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 = $IID_IRowsetNotify
IF pthis = 0 THEN FUNCTION = -1 : EXIT FUNCTION
HRESULT = IRowsetNotifyEvents_QueryInterface(pthis, IID_CPC, pCPC)
IF HRESULT <> 0 THEN FUNCTION = HRESULT : EXIT FUNCTION
HRESULT = IRowsetNotifyEvents_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
IRowsetNotifyEvents_Release pCPC
IF HRESULT <> 0 THEN FUNCTION = HRESULT : EXIT FUNCTION
HRESULT = IRowsetNotifyEvents_IConnectionPoint_Unadvise(pCP, dwCookie)
IRowsetNotifyEvents_Release pCP
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
|
Page last updated on Wednesday, 15 February 2006 23:45:35 +0100