次の方法で共有


IMDServiceProvider2::CreateDevice

banner art

The CreateDevice method is called by the Windows Media Device Manager to get the IMDSPDevice object(s) corresponding to the canonical device obtained from the PnP subsystem. This method must be implemented for PnP and Windows Explorer support, but otherwise it is optional. For more information, see Mandatory and Optional Interfaces.

Syntax

HRESULT CreateDevice(LPCWSTRpwszDevicePath,DWORD*pdwCount,IMDSPDevice***pppDeviceArray);

Parameters

pwszDevicePath

[in]  Pointer to a wide-character null-terminated string containing the device path of the device detected by Windows Media Device Manager. This name is obtained from the PnP subsystem, and is the canonical name plus "$#", where # is an auto-

incremented number. This name can be passed directly to functions such as CreateFile to gain access to the underlying kernel device object. The service provider should create a wrapper IMDSPDevice object(s) for this device.

pdwCount

[out]  Pointer to a DWORD containing the number of IMDSPDevice objects that are created.

pppDeviceArray

[out]  An array of IMDSPDevice interfaces representing the devices. Typically, there is only one array element, but a service provider can create more than one IMDSPDevice object corresponding to a device path name if it creates an IMDSPDevice object for each top-level storage. This is subject to change in the future, and the count may be restricted to 1.

Return Values

If the method succeeds it returns S_OK. If the method fails, it returns the Windows Media Device Manager error codes.

For an extenstive list of possible error codes, see Error Codes.

Remarks

Windows Media Device Manager calls this method when an application starts, or when a Plug and Play compliant device connects with the computer.

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also