共用方式為


轉換 Unicode 和 ANSI 字串

Microsoft Active Accessibility 使用由 BSTR 數據類型定義的 Unicode 字串。 如果您的應用程式不使用 Unicode 字串,或您想要針對特定 API 呼叫轉換字串,請使用 MultiByteToWideCharWideCharToMultiByte Microsoft Win32 函式來執行必要的轉換。

使用 WideCharToMultiByte,將 Unicode 字串轉換成 ANSI 字串。 MultiByteToWideChar 函式會將 ANSI 字串轉換成 Unicode 字串。

使用 SysAllocStringSysFreeString 來配置和 釋放 BSTR 數據類型。

如需這些字串函式的詳細資訊,請參閱 Windows 軟體開發工具套件 (SDK) 中的參考。