|
|
|
IHWEventHandler Interface |
|
IID_IHWEventHandler |
{C1FB73D0-EC3A-4ba2-B512-8CDB9187B6D1} |
|
This interface is called by AutoPlay to implement the handling of registered media types.
Remarks
Developers supporting this interface must expose it in a Component Object Model (COM) server.
All applications registered as AutoPlay media handlers must implement this interface.
|
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
IHWEventHandler Methods |
Description |
|
Initialize |
This method initializes an object that contains an implementation of the IHWEventHandler interface. |
|
HandleEvent |
Handles AutoPlay device events for which there is no content of the type the application is registered to handle. |
|
HandleEventWithContent |
Not currently implemented. |
|
Initialize |
|
FUNCTION IHWEventHandler_Initialize ( _ BYVAL pthis AS DWORD PTR _ , BYVAL strParams AS STRING _ )
AS LONG strParams =
UCODE$(strParams) & $NUL
|
|
HandleEvent |
|
FUNCTION IHWEventHandler_HandleEvent ( _ BYVAL pthis AS DWORD PTR _ , BYVAL strDeviceID AS STRING _ , BYVAL strAltDeviceID AS STRING _ , BYVAL strEventType AS STRING _ )
AS DWORD
strDeviceID =
UCODE$(strDeviceID) & $NUL
|
|
HandleEventWithContent |
|
FUNCTION IHWEventHandler_HandleEventWithContent ( _ BYVAL pthis AS DWORD PTR _ , BYVAL strDeviceID AS STRING _ , BYVAL strAltDeviceID AS STRING _ , BYVAL strEventType AS STRING _ , BYVAL strContentTypeHandler AS STRING _ , BYVAL pdataobject AS DWORD _ )
AS LONG
|
|
IHWEventHandler interface implementation |
$IID_IHWEventHandler = GUID$("{C1FB73D0-EC3A-4ba2-B512-8CDB9187B6D1}")
' ****************************************************************************************
' IHWEventHandler interface
' ****************************************************************************************
TYPE IHWEventHandlerVtbl
' IUnknown methods
pQueryInterface AS DWORD ' // QueryInterface method
pAddRef AS DWORD ' // AddRef method
pRelease AS DWORD ' // Release method
' IHWEventHandler members
pInitialize AS DWORD ' // Initialize method
pHandleEvent AS DWORD ' // HandleEvent method
pHandleEventWithContent AS DWORD ' // HandleEventWithContent method
' Custom data
pVtblAddr AS DWORD ' // Address of the virtual table
cRef AS DWORD ' // Reference count
END TYPE
' ****************************************************************************************
' ****************************************************************************************
' Builds the IHWEventHandler Virtual Table
' Returns a cookie that is a pointer to a IHWEventHandlerVtbl structure.
' ****************************************************************************************
FUNCTION IHWEventHandler_BuildVtbl () AS DWORD
LOCAL pVtbl AS IHWEventHandlerVtbl PTR
LOCAL pUnk AS IHWEventHandlerVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVtbl.pQueryInterface = CODEPTR(IHWEventHandler_QueryInterface)
@pVtbl.pAddRef = CODEPTR(IHWEventHandler_AddRef)
@pVtbl.pRelease = CODEPTR(IHWEventHandler_Release)
@pVtbl.pInitialize = CODEPTR(IHWEventHandler_Initialize)
@pVtbl.pHandleEvent = CODEPTR(IHWEventHandler_HandleEvent)
@pVtbl.pHandleEventWithContent = CODEPTR(IHWEventHandler_HandleEventWithContent)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.cRef = 1
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IHWEventHandler_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION IHWEventHandler_QueryInterface (BYVAL pCookie AS IHWEventHandlerVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
IF riid = $IID_IHWEventHandler THEN
ppvObj = pCookie
INCR @@pCookie.cRef
FUNCTION = %S_OK
ELSE
FUNCTION = %E_NOINTERFACE
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IHWEventHandler_AddRef method
' Increments the reference counter.
' ****************************************************************************************
FUNCTION IHWEventHandler_AddRef (BYVAL pCookie AS IHWEventHandlerVtbl PTR) AS DWORD
INCR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IHWEventHandler_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IHWEventHandler_Release (BYVAL pCookie AS IHWEventHandlerVtbl 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
' ****************************************************************************************
' ****************************************************************************************
' This method initializes an object that contains an implementation of the IHWEventHandler
' interface.
' ****************************************************************************************
FUNCTION IHWEventHandler_Initialize (BYVAL pCookie AS IHWEventHandlerVtbl PTR, BYVAL pszParams AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Handles AutoPlay device events for which there is no content of the type the application
' is registered to handle.
' ****************************************************************************************
FUNCTION IHWEventHandler_HandleEvent (BYVAL pCookie AS IHWEventHandlerVtbl PTR, BYVAL pszDeviceID AS DWORD, BYVAL pszAltDeviceID AS DWORD, BYVAL pszEventType AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Not currently implemented.
' ****************************************************************************************
FUNCTION IHWEventHandler_HandleEventWithContent (BYVAL pCookie AS IHWEventHandlerVtbl PTR, BYVAL pszDeviceID AS DWORD, BYVAL pszAltDeviceID AS DWORD, BYVAL pszEventType AS DWORD, BYVAL pszContentTypeHandler AS DWORD, BYVAL pdataobject AS DWORD) AS LONG
' Put your code here
END FUNCTION
' ****************************************************************************************
|
Page last updated on Monday, 03 April 2006 20:41:11 +0200