|
|
|
IDBAsynchNotify Interface |
|
IID_IDBAsynchNotify |
{0997A571-126E-11D0-9F8A-00A0C9A0631E} |
|
IDBAsynchNotify is the callback interface that a consumer must support to get notified of the progress of asynchronous operations such as initializing a data source object or opening or populating a rowset.
Documentation: IDBASynchNotify
|
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
IDBAsynchNotify Method |
Description |
|
OnLowResource |
Indicates that resources are low. |
|
OnProgress |
Indicates the current progress of the operation. |
|
OnStop |
Indicates that the asynchronous processing has stopped. |
|
IDBAsynchNotify interface implementation |
$IID_IDBAsynchNotify = GUID$("{0C733A96-2A1C-11CE-ADE5-00AA0044773D")
' ****************************************************************************************
' IDBAsynchNotify interface
' ****************************************************************************************
TYPE IDBAsynchNotifyVtbl
' IUnknown methods
pQueryInterface AS DWORD ' // QueryInterface method
pAddRef AS DWORD ' // AddRef method
pRelease AS DWORD ' // Release method
' IDBAsynchNotify members
pOnLowResource AS DWORD ' // OnLowResource method
pOnProgress AS DWORD ' // OnProgress method
pOnStop AS DWORD ' // OnStop 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 IDBAsynchNotify Virtual Table
' Returns a cookie that is a pointer to a IDBAsynchNotifyVtbl structure.
' ****************************************************************************************
FUNCTION IDBAsynchNotify_BuildVtbl (BYVAL pthis AS DWORD) AS DWORD
LOCAL pVtbl AS IDBAsynchNotifyVtbl PTR
LOCAL pUnk AS IDBAsynchNotifyVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVtbl.pQueryInterface = CODEPTR(IDBAsynchNotify_QueryInterface)
@pVtbl.pAddRef = CODEPTR(IDBAsynchNotify_AddRef)
@pVtbl.pRelease = CODEPTR(IDBAsynchNotify_Release)
@pVtbl.pOnLowResource = CODEPTR(IDBAsynchNotify_OnLowResource)
@pVtbl.pOnProgress = CODEPTR(IDBAsynchNotify_OnProgress)
@pVtbl.pOnStop = CODEPTR(IDBAsynchNotify_OnStop)
@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 IDBAsynchNotifyEvents_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 IDBAsynchNotifyEvents_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 IDBAsynchNotifyEvents_Release (BYVAL pthis AS DWORD PTR) AS DWORD
LOCAL HRESULT AS DWORD
CALL DWORD @@pthis[2] USING IDBAsynchNotifyEvents_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 IDBAsynchNotifyEvents_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 IDBAsynchNotifyEvents_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 IDBAsynchNotifyEvents_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 IDBAsynchNotifyEvents_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 IDBAsynchNotifyEvents_IConnectionPoint_Unadvise (BYVAL pthis AS DWORD PTR, BYVAL dwCookie AS DWORD) AS LONG
LOCAL HRESULT AS LONG
CALL DWORD @@pthis[6] USING IDBAsynchNotifyEvents_IConnectionPoint_Unadvise(pthis, dwCookie) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ******************************************************************************************
' UI4 AddRef()
' ******************************************************************************************
FUNCTION IDBAsynchNotify_AddRef (BYVAL pCookie AS IDBAsynchNotifyVtbl PTR) AS DWORD
INCR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ******************************************************************************************
' ******************************************************************************************
' HRESULT QueryInterface([in] *GUID riid, [out] **VOID ppvObj)
' ******************************************************************************************
FUNCTION IDBAsynchNotify_QueryInterface (BYVAL pCookie AS IDBAsynchNotifyVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
IF riid = $IID_IDBAsynchNotify THEN
ppvObj = pCookie
IDBAsynchNotify_AddRef pCookie
FUNCTION = %S_OK
ELSE
FUNCTION = %E_NOINTERFACE
END IF
END FUNCTION
' ******************************************************************************************
' ******************************************************************************************
' UI4 Release()
' ******************************************************************************************
FUNCTION IDBAsynchNotify_Release (BYVAL pCookie AS IDBAsynchNotifyVtbl 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 IDBAsynchNotify_OnLowResource (BYVAL pCookie AS IDBAsynchNotifyVtbl 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 IDBAsynchNotify_OnProgress (BYVAL pCookie AS IDBAsynchNotifyVtbl 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 IDBAsynchNotify_OnStop (BYVAL pCookie AS IDBAsynchNotifyVtbl 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 IDBAsynchNotify_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_IDBAsynchNotify
IF pthis = 0 THEN FUNCTION = -1 : EXIT FUNCTION
HRESULT = IDBAsynchNotifyEvents_QueryInterface(pthis, IID_CPC, pCPC)
IF HRESULT <> 0 THEN FUNCTION = HRESULT : EXIT FUNCTION
HRESULT = IDBAsynchNotifyEvents_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
IDBAsynchNotifyEvents_Release pCPC
IF HRESULT <> 0 THEN FUNCTION = HRESULT : EXIT FUNCTION
pUnkSink = IDBAsynchNotify_BuildVtbl(pthis)
IF ISTRUE pUnkSink THEN HRESULT = IDBAsynchNotifyEvents_IConnectionPoint_Advise(pCP, pUnkSink, dwCookie)
IDBAsynchNotifyEvents_Release pCP
pdwCookie = dwCookie
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Releases the events connection identified with the cookie returned by the ConnectEvents function
' ****************************************************************************************
FUNCTION IDBAsynchNotify_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_IDBAsynchNotify
IF pthis = 0 THEN FUNCTION = -1 : EXIT FUNCTION
HRESULT = IDBAsynchNotifyEvents_QueryInterface(pthis, IID_CPC, pCPC)
IF HRESULT <> 0 THEN FUNCTION = HRESULT : EXIT FUNCTION
HRESULT = IDBAsynchNotifyEvents_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
IDBAsynchNotifyEvents_Release pCPC
IF HRESULT <> 0 THEN FUNCTION = HRESULT : EXIT FUNCTION
HRESULT = IDBAsynchNotifyEvents_IConnectionPoint_Unadvise(pCP, dwCookie)
IDBAsynchNotifyEvents_Release pCP
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
|
Page last updated on Wednesday, 15 February 2006 23:25:06 +0100