![]() ![]() Hr = pDevMgr3->SetDeviceEnumPreference(DO_NOT_VIRTUALIZE_STORAGES_AS_DEVICES) This can be called only once for each instance of this application. Change behavior to show devices as one object, not each storage as a device. The following C++ code enumerates devices and requests information about each device. For more information on this, see Enabling Notifications. This is done by implementing the IWMDMNotification interface and registering it. If retrieving only one device at a time, you do not need to allocate an array to hold the devices.īecause users can attach or remove devices from the computer while your application is running, it is a good idea to implement notification of device connection or removal. Continue to call this method until the method returns S_FALSE or an error message. Call the IWMDMEnumDevices::Next method to retrieve one or more devices at a time.(If supported, use EnumDevices2, which is more efficient, as the earlier version may not return MTP devices). Query for IWMDeviceManager or IWMDeviceManager2, and then call IWMDeviceManager2::EnumDevices2 to obtain the device enumerator interface, IWMDMEnumDevice.To determine whether individual "devices" are actually storages on the same device, call IWMDMDevice2::GetCanonicalName storages from the same device will return identical values, except for the final digit after the last "$" sign. If this method is not called, the default method is to show storages as separate devices. Set the device enumeration preference using IWMDeviceManager3::SetDeviceEnumPreference.The following steps show how to enumerate connected devices: ![]() However, note that legacy devices will sometimes ignore a request to enumerate separate device storages as a single device, and continue to enumerate them separately. You can set this preference only once in your application if you want to change it, you must shut down the application and restart it. You can specify that all storages on a device are enumerated together as a single device. For example, two flash memory cards on a device will enumerate as if they were separate devices. Some devices expose each storage as a different device. If supported, use the EnumDevices2 method, because the earlier version only returned legacy interfaces on devices, whereas the new version returns both the legacy and the new interfaces.īefore obtaining an enumerator, you should decide what enumeration view to use. Enumeration is done by using an enumeration interface, IWMDMEnumDevice, obtained by using either IWMDeviceManager2::EnumDevices2 or IWMDeviceManager::EnumDevices. After authenticating an application, you can begin to enumerate the devices detected by Windows Media Device Manager. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |