IWiaItem2::CreateChildItem method

Create a new child item. Adds IWiaItem2 objects to a device's IWiaItem2 tree.


HRESULT CreateChildItem(
  [in]  LONG      lItemFlags,
  [in]  LONG      lCreationFlags,
  [in]  BSTR      bstrItemName,
  [out] IWiaItem2 **ppIWiaItem2


lItemFlags [in]

Type: LONG

Specifies the WIA 2.0 item type. See WIA Item Type Flags.

lCreationFlags [in]

Type: LONG

Specifies how to create the new item.

0 (0)

Set the default values for the properties of the child.


Copy the values of all Read/Write properties from the parent.

bstrItemName [in]

Type: BSTR

Specifies the item name. This name is appended to the end of the parent item's name to generate the full item name.

ppIWiaItem2 [out]

Type: IWiaItem2**

Receives the address of a pointer to the IWiaItem2 interface that sets the IWiaItem2::CreateChildItem method.

Return value


If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


Some WIA 2.0 hardware devices allow applications to create new items in the IWiaItem2 tree that represents the device. Applications must test the devices to see if they support this capability. Use the IEnumWIA_DEV_CAPS interface to enumerate the current device's capabilities.

If the device allows the creation of new items in the IWiaItem2 tree, invoking IWiaItem2::CreateChildItem creates a new IWiaItem2 object that is a child of the current node. It passes a pointer to the new node to the application through the ppIWiaItem2 parameter. Applications must call the IUnknown::Release method on the interface pointers they receive through the ppIWiaItem2 parameter.

If lCreationFlags is COPY_PARENT_PROPERTY_VALUES and lItemFlags is zero, the function returns E_INVALIDARG.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]