Share via


StorageDevice 類別

定義

提供存取支援 WPD 之可攜式裝置儲存功能的方法。 卸載式儲存裝置包括:

  • USB 大量儲存快閃磁片磁碟機和相機
  • 媒體傳輸通訊協定 (MTP) 音樂播放機、手機和相機
  • 圖片傳輸通訊協定 (PTP) 相機
public ref class StorageDevice abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Devices.Portable.PortableDeviceContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class StorageDevice final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Devices.Portable.PortableDeviceContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public static class StorageDevice
Public Class StorageDevice
繼承
Object Platform::Object IInspectable StorageDevice
屬性

Windows 需求

裝置系列
Windows Desktop Extension SDK (已於 10.0.10240.0 引進)
API contract
Windows.Devices.Portable.PortableDeviceContract (已於 v1.0 引進)
應用程式功能
removableStorage

範例

下列範例顯示 FromId呼叫的語法。

var folder = StorageDevice.FromId(deviceInformationId);
StorageFolder folder{ StorageDevice::FromId(deviceInformationId) };
StorageFolder^ folder = StorageDevice::FromId(deviceInformationId);

備註

若要存取裝置服務,您必須在應用程式資訊清單檔案的功能區段中宣告裝置服務。 如需代表裝置服務的 GUID 清單,請參閱 Windows.Devices.Portable

方法

FromId(String)

從卸載式儲存裝置的 DeviceInformation 識別碼取得 StorageFolder 物件。

GetDeviceSelector()

用於識別抽取式儲存裝置的進階查詢語法 (AQS) 字串。 此字串會傳遞至 FindAllAsyncCreateWatcher 方法。

適用於

另請參閱