|
|
|
IErrorLog Interface |
|
IID_IErrorLog |
{3127CA40-446E-11CE-8135-00AA004BB851} |
|
The IErrorlog
interface is an abstraction for an error log that is used to communicate
detailed error information between a client and an object. |
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
IErrorLog Members |
Description |
|
AddError |
Logs an error (using an EXCEPINFO structure) in the error log for a named property. |
|
AddError |
|
FUNCTION
IErrorLog_AddError ( _ , BYVAL strPropName AS STRING _ , BYREF pExcepInfo AS EXCEPINFO _ ) AS
LONG
strPropName = UCODE$(strPropName)
& $NUL |
|
IErrorLog interface implementation |
$IID_IErrorLog = GUID$("{3127CA40-446E-11CE-8135-00AA004BB851}")
' ****************************************************************************************
' IErrorLog interface
' ****************************************************************************************
TYPE IErrorLogVtbl
' IUnknown methods
pQueryInterface AS DWORD ' // QueryInterface method
pAddRef AS DWORD ' // AddRef method
pRelease AS DWORD ' // Release method
' IErrorLog members
pAddError AS DWORD ' // AddError method
' Custom data
pVtblAddr AS DWORD ' // Address of the virtual table
cRef AS DWORD ' // Reference count
END TYPE
' ****************************************************************************************
' ****************************************************************************************
' Builds the IErrorLog Virtual Table
' Returns a cookie that is a pointer to a IErrorLogVtbl structure.
' ****************************************************************************************
FUNCTION IErrorLog_BuildVtbl () AS DWORD
LOCAL pVtbl AS IErrorLogVtbl PTR
LOCAL pUnk AS IErrorLogVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVtbl.pQueryInterface = CODEPTR(IErrorLog_QueryInterface)
@pVtbl.pAddRef = CODEPTR(IErrorLog_AddRef)
@pVtbl.pRelease = CODEPTR(IErrorLog_Release)
@pVtbl.pAddError = CODEPTR(IErrorLog_AddError)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.cRef = 1
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IErrorLog_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION IErrorLog_QueryInterface (BYVAL pCookie AS IErrorLogVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
IF riid = $IID_IErrorLog THEN
ppvObj = pCookie
INCR @@pCookie.cRef
FUNCTION = %S_OK
ELSE
FUNCTION = %E_NOINTERFACE
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IErrorLog_AddRef method
' Increments the reference counter.
' ****************************************************************************************
FUNCTION IErrorLog_AddRef (BYVAL pCookie AS IErrorLogVtbl PTR) AS DWORD
INCR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IErrorLog_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IErrorLog_Release (BYVAL pCookie AS IErrorLogVtbl 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
' ****************************************************************************************
' ****************************************************************************************
' Logs an error (using an EXCEPINFO structure) in the error log for a named property.
' ****************************************************************************************
FUNCTION IErrorLog_AddError (BYVAL pCookie AS IErrorLogVtbl PTR, BYVAL pszPropName AS DWORD, BYREF pExcepInfo AS EXCEPINFO) AS LONG
' Put your code here
' FUNCTION = %S_OK
END FUNCTION
' ****************************************************************************************
|
Page last updated on Monday, 03 April 2006 20:25:08 +0200