可用於 Windows 運行時應用的 Windows API 替代項

瞭解哪些 Windows API 功能可用於 Windows 運行時應用或通用 Windows 平臺 (UWP) 應用,而對於那些不能使用的 API,有哪些替代項。

注意

一些 API 僅受 Windows 應用商店應用支持,不受 Windows Phone 應用商店應用支持,反之亦然。特定 API 的具體兼容性詳細信息可在其參考主題或相關頭文件中找到。有關詳細信息,請參閱 Win32 和 COM。

應用安裝
現有的應用安裝 API 都不支持用於 Windows 運行時應用或 UWP 應用。這裏是一些應用安裝 API 的替代項:

應用包
打包和部署 API
Windows.ApplicationModel.Package 類
Windows.Management.Deployment 命名空間
設備
設備 API 的一個子集支持用於 Windows 運行時應用或 UWP 應用。有關詳細信息,請參閱 Win32 和 COM(設備)。

對於不能用於 Windows 運行時應用或 UWP 應用的設備 API,下面提供了一些替代項。

功能 替代項
Bluetooth Windows.Networking.Proximity
設備枚舉(功能發現、PnP-X 和 WSD) Windows.Devices.Enumeration
傳真 無
位置 API Windows.Devices.Geolocation
打印 Windows.Graphics.Printing
3D 打印 Windows.Graphics.Printing3D
傳感器 Windows.Devices.Sensors
串行和並行端口 Windows.Devices.SerialCommunication
短信 Windows.Devices.Sms
UPnP Windows.Devices.Enumeration.Pnp
Windows 便攜設備 Windows.Devices.Portable
WSD Windows.Devices.Enumeration
電池
Windows.Devices.Power
Windows.System.Power

圖形
這些圖形 API 的子集至少部分支持用於 Windows 運行時應用或 UWP 應用:

Direct2D
Direct3D 11
DirectWrite
DirectXMath
DXGI
WIC
有關詳細信息,請參閱 Win32 和 COM(圖形)。

在設計 Windows 運行時應用或 UWP 應用時,你可能想要使用 HTML5 或 XAML 以顯示圖形。有關詳細信息,請參閱:

顯示圖形 (XAML)
藉助畫布、SVG 和 CSS3 使用圖形 (HTML)
多媒體
這些多媒體 API 的子集至少部分支持用於 Windows 運行時應用或 UWP 應用:

內核音頻
媒體播放
媒體基礎
Windows 音頻會話 API (WASAPI)
有關詳細信息,請參閱 Win32 和 COM(多媒體)。

在設計 Windows 運行時應用或 UWP 應用時,你可能想要使用 HTML5 或 XAML 以集成媒體。有關詳細信息,請參閱:

如果使用 HTML5 播放本機媒體文件
快速入門:視頻和音頻 (XAML)
網絡
這些網絡 API 的子集至少部分支持用於 Windows 運行時應用或 UWP 應用:

DHCP
移動寬帶
RPC
Windows 套接字 (Winsock)
Windows Web 服務
有關詳細信息,請參閱 Win32 和 COM(網絡)。

這裏是一些針對不能用於 Windows 運行時應用或 UWP 應用的網絡 API 的替代項。

功能 替代項
BITS Windows.Networking.BackgroundTransfer
EAP 無
防火牆 無
HTTP 服務器 無
IP 幫助程序 Windows.Networking.Connectivity
NDF 無
NLM Windows.Networking.Connectivity
P2P 無
QOS Windows.Networking.Sockets
RAS 無
SNMP 無
TAPI 無
WinHTTP Windows.Web.Http 和 XML HTTP 擴展請求(IXMLHttpRequest2 和 IXMLHttpRequest3)
WinINet Windows.Web.Http 和 XML HTTP 擴展請求(IXMLHttpRequest2 和 IXMLHttpRequest3)
Winsock Windows.Networking.Sockets

打印和文檔
打印和文檔 API 的一個子集支持用於 Windows 應用商店應用。有關詳細信息,請參閱 Win32 和 COM(打印和文檔)。

在設計 Windows 應用商店應用時,你可能想要提供最佳的打印體驗:

打印 (JavaScript)
打印 (XAML)
安全
不支持將現有的安全 API 用於 Windows 運行時應用或 UWP 應用。下面是一些安全 API 的替代項:

Windows.Security.Credentials
Windows.Security.Credentials.UI
Windows.Security.Cryptography
Windows.Security.Cryptography.Certificates
Windows.Security.Cryptography.Core
Windows.Security.Cryptography.DataProtection
存儲
這些存儲 API 的子集至少部分支持用於 Windows 運行時應用或 UWP 應用:

目錄創建、刪除和枚舉
文件映射
有關詳細信息,請參閱 Win32 和 COM(數據)。

這裏是一些針對不能用於 Windows 運行時應用或 UWP 應用的存儲 API 的替代項。

功能 替代項
文件複製、移動和替換 Windows.Storage.StorageFile
目錄創建、刪除和枚舉 Windows.Storage.StorageFolder
IMAPI 無
管理(裝入點、格式和配額) 無
Oplock 無
搜索 Windows.Storage.Search
USN 日誌 無

系統
這些系統 API 的子集至少部分支持用於 Windows 運行時應用或 UWP 應用:

堆 API,線程本地存儲 (TLS)
上一個錯誤
同步
有關詳細信息,請參閱 Win32 和 COM(系統)。

這裏是一些針對不能用於 Windows 運行時應用或 UWP 應用的系統 API 的替代項。

功能 替代項
控制檯 無
當前目錄 無
光纖 無
內存管理程序 堆 API
命名管道 無
電源
Windows.Devices.Power
Windows.System.Power
Windows.System.Power.Diagnostics
註冊表
Windows.Storage.ApplicationDataContainer
Windows.Storage.ApplicationDataContainerSettings
線程池 Windows.System.Threading
線程數 Windows.System.Threading

用戶界面
這些用戶界面 API 的子集至少部分支持用於 Windows 運行時應用或 UWP 應用:

區域語言支持 (NLS)
Strsafe 函數
文本服務框架 (TSF)
UI 自動化
Windows 動畫管理器
有關詳細信息,請參閱 Win32 和 COM(用戶界面)。

這裏是一些針對不能用於 Windows 運行時應用或 UWP 應用的用戶界面 API 的替代項。

功能 替代項
公共控件 HTML 和 XAML
DDE/NetDDE 無
DWM 無
文件打開和文件保存
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.UI.Core.CoreCursor
用戶:剪貼板 Windows.ApplicationModel.DataTransfer.Clipboard
用戶:控件 HTML 和 XAML
用戶:顯示 Windows.Graphics.Display
用戶:高 DPI 應用可感知 DPI
用戶:掛機 無
用戶:圖標 用磁貼表示應用
用戶:鍵盤加速 Windows.UI.Core.CoreAcceleratorKeys
用戶:鍵盤輸入 Windows.Devices.Input
用戶:MDI 無
用戶:消息 事件和通知
用戶:鼠標輸入 Windows.Devices.Input
用戶:多個監視器 單個監視器
用戶:SystemParametersInfo Windows.Devices.Input
用戶:字符串 Strsafe 函數
用戶:定時器 無
用戶:關機 無
用戶:窗口化
Windows.UI.Core.CoreWindow
Windows.UI.Core.CoreWindowDialog
Windows.UI.Core.CoreWindowFlyout
Windows 動畫管理器 Windows.UI.Core.AnimationMetrics
Windows 功能區 HTML 和 XAML

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章