IWDFDevice3::CreateWorkItem method
The CreateWorkItem method creates a framework work-item object, which can subsequently be added to the framework’s work-item queue.
Syntax
HRESULT CreateWorkItem( [in] PWUDF_WORKITEM_CONFIG pConfig, [in, optional] IWDFObject *pParentObject, [out] IWDFWorkItem **ppWorkItem );
Parameters
- pConfig [in]
-
A pointer to a caller-allocated WUDF_WORKITEM_CONFIG structure that the driver must have already initialized by calling WUDF_WORKITEM_CONFIG_INIT.
- pParentObject [in, optional]
-
A pointer to the parent object interface or NULL.
- ppWorkItem [out]
-
A pointer to a buffer that receives a pointer to the IWDFWorkItem interface for the new WorkItem object.
Return value
The method returns S_OK if the operation succeeds. Otherwise, this method returns one of the error codes that are defined in Winerror.h.
Remarks
If you specify a parent object, the framework automatically deletes the work-item when the parent object is deleted. Alternatively, the driver can call IWDFObject::DeleteWdfObject to delete a work-item. The driver must not delete a work-item in its OnWorkItem callback function.
For more information, see Using Work Items.
Examples
WUDF_WORKITEM_CONFIG config;
WUDF_WORKITEM_CONFIG_INIT(&config, OnWorkItem);
hr = m_IWdfDevice3->CreateWorkItem(&config,
m_IWdfDevice3,
&m_WorkItem);
Requirements
|
End of support | Unavailable in UMDF 2.0 and later. |
|---|---|
|
Minimum UMDF version | 1.11 |
|
Header |
|
|
DLL |
|
See also
