了解 Windows API 的哪些功能可在通用 Windows 平台 (UWP) 应用中使用,哪些 api 用作不能使用的替代项。
应用安装
UWP 应用中不支持任何现有的应用安装 Api。 下面是应用安装 Api 的一些替代方案:
设备
UWP 应用支持设备 Api 子集。
对于无法在 UWP 应用中使用的设备 Api,以下是一些替代项。
| 功能 | 替代方法 |
|---|---|
| Bluetooth | Windows.Devices.Bluetooth |
| 设备枚举 (函数发现,Pnp-x,WSD) | Windows.Devices.Enumeration |
| 传入 | 无 |
| 位置 API | Windows。设备. 地理位置 |
| 打印 | Windows。图形打印 |
| 3D 打印 | Windows。Printing3D |
| 传感器 | Windows.Devices.Sensors |
| 串行和并行端口 | Windows.Devices.SerialCommunication |
| SMS | Windows.Devices.Sms |
| UPnP | Windows.Devices.Enumeration.Pnp |
| Windows 便携设备 | Windows.Devices.Portable |
| 关于 | Windows.Devices.Enumeration |
| 电池 |
Windows.Devices.Power Windows。系统电源 |
显卡
UWP 应用中至少部分支持这些图形 Api 的子集:
- Direct2D
- Direct3D 11
- DirectWrite
- DirectXMath
- DXGI
- WIC
下面是一些替代方案:
多媒体
UWP 应用中至少部分支持这些多媒体 Api 的子集:
- 核心音频
- 媒体播放
- 媒体基础
- Windows 音频会话 API (WASAPI)
有关适用于 UWP 应用的 API 的详细信息,请参阅 音频、视频和照相机
网络
UWP 应用中至少部分支持这些网络 Api 的子集:
- DHCP
- 移动宽带
- RPC
- Windows 套接字 (Winsock)
- Windows Web 服务
以下是无法在 UWP 应用中使用的网络 Api 的一些替代项。
| 功能 | 替代方法 |
|---|---|
| BITS | Windows.Networking.BackgroundTransfer |
| EAP | 无 |
| 防火墙 | 无 |
| HTTP 服务器 | 无 |
| IP 帮助程序 | Windows.Networking.Connectivity |
| .NDF | 无 |
| NLM | Windows.Networking.Connectivity |
| P2P | 无 |
| QOS | Windows.Networking.Sockets |
| RA | 无 |
| SNMP | 无 |
| TAPI | 无 |
| WinHTTP | Windows.Web.Http |
| WinINet | Windows.Web.Http |
| Winsock | Windows.Networking.Sockets |
打印和文档
UWP 应用支持打印和文档 API 的子集。
设计 UWP 应用时,需要提供最佳打印体验:
安全性
UWP 应用不支持任何现有安全 API。 下面是安全 API 的一些替代方法:
- Windows。Security.Credentials
- Windows.Security.Credentials.UI
- Windows.Security.Cryptography
- Windows。Security.Cryptography.Certificates
- Windows.Security.Cryptography.Core
- Windows.Security.Cryptography.DataProtection
存储
UWP 应用中至少部分支持这些存储 API 的子集:
- 目录创建、删除和枚举
- 文件映射
下面是无法在 UWP 应用中使用的 Win32 存储 API 的一些替代方法。
| 功能 | 替代方法 |
|---|---|
| 文件复制、移动和替换 | Windows.Storage.StorageFile |
| 目录创建、删除和枚举 | Windows.Storage.StorageFolder |
| IMAPI | 无 |
| 管理 (装入点、格式、配额) | 无 |
| Oplocks | 无 |
| 搜索 | Windows。存储。搜索 |
| USN 日志 | 无 |
系统
UWP 应用中至少部分支持这些系统 API 的子集:
- 堆 API、线程本地存储 (TLS)
- 上次错误
- 同步
下面是无法在 UWP 应用中使用的系统 API 的一些替代方法。
| 功能 | 替代方法 |
|---|---|
| 控制台 | 创建 UWP 控制台应用 |
| 当前目录 | 无 |
| 纤维 | 无 |
| 内存管理器 | 堆 API |
| Named pipes | 进程间通信 |
| 强力 |
Windows.Devices.Power Windows。System.Power Windows。System.Power.Diagnostics |
| 注册表 |
Windows.Storage.ApplicationDataContainer Windows.Storage.ApplicationDataContainerSettings |
| 线程池 | Windows.System.Threading |
| 线程数 | Windows.System.Threading |
用户界面
UWP 应用中至少部分支持这些用户界面 API 的子集:
- 本地语言支持 (NLS)
- Strsafe 函数
- 文本服务框架 (TSF)
- UI 自动化
- Windows动画管理器
下面是无法在 UWP 应用中使用的用户界面 API 的一些替代方法。
| 功能 | 替代方法 |
|---|---|
| 公共控件 | HTML、XAML |
| DDE/NetDDE | 无 |
| DWM | Windows.UI.Composition |
| 文件打开,文件保存 |
Windows.Storage.Pickers.FileOpenPicker Windows.Storage.Pickers.FileSavePicker |
| IMM | TSF |
| 放大镜 | 无 |
| MSAA | UI 自动化 |
| NLS |
Windows.Globalization Windows.Globalization.DateTimeFormatting Windows.Globalization.NumberFormatting |
| RichEdit | HTML、XAML |
| 主题设置 | HTML、CSS、XAML |
| 触摸 | Windows.UI.Input |
| 用户:插入符号 | 要绘制的框架或应用 |
| 用户:游标 | Windows。无.CoreCursor |
| 用户:剪贴板 | Windows。Windows.applicationmodel.resources.core. DataTransfer. 剪贴板 |
| 用户:控件 | HTML、XAML |
| 用户:显示 | Windows。显示图形 |
| 用户:高 DPI | 应用程序感知 DPI |
| 用户:挂钩 | 无 |
| 用户:图标 | 磁贴表示的应用 |
| 用户:键盘加速 | Windows。无.CoreAcceleratorKeys |
| 用户:键盘输入 | Windows.Devices.Input |
| 用户: MDI | TABVIEW XAML 控件, AppWindow |
| 用户:消息 | 事件和通知 |
| 用户:鼠标输入 | Windows.Devices.Input |
| 用户: multimon | 单个监视器 |
| 用户: SystemParametersInfo | Windows.Devices.Input |
| 用户:字符串 | strsafe 函数 |
| 用户:计时器 | 无 |
| 用户:关闭 | 无 |
| 用户:窗口化 |
Windows.UI.Core.CoreWindow Windows。无.CoreWindowDialog Windows。无.CoreWindowFlyout |
| Windows 动画管理器 | Windows.UI.Core.AnimationMetrics |
| Windows 功能区 | HTML、XAML |