Converting Unicode and ANSI Strings

Microsoft Active Accessibility uses Unicode strings as defined by the BSTR data type. If your application does not use Unicode strings, or if you want to convert strings for certain API calls, use the MultiByteToWideChar and WideCharToMultiByte Microsoft Win32 functions to perform the necessary conversion.

Use WideCharToMultiByte to convert a Unicode string to an ANSI string. The MultiByteToWideChar function converts an ANSI string to a Unicode string.

Use SysAllocString and SysFreeString to allocate and free BSTR data types.

For more information about these string functions, see their references in the Windows Software Development Kit (SDK).