Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function allocates a new string and copies the passed string into it. This function returns null if there is insufficient memory or if a null pointer is passed in.

Syntax

BSTR SysAllocString(
  OLECHAR FAR* 
sz
);

Parameters

sz

[in] Null-terminated string to copy. The string must be a Unicode string in 32-bit applications, and an ANSI string in 16-bit applications.

Return Value

Returns the allocated string to indicate success, or NULL to indicate that insufficient memory exists or that the szparameter was NULL.

Remarks

Windows Embedded CE and Windows Mobile support only Unicode strings.

Passing invalid (and under some circumstances NULL) pointers to this function causes an unexpected termination of the application.

You can free strings created with SysAllocStringusing SysFreeString.

Requirements

Header oleauto.h
Library oleaut32.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also