共用方式為


SysAllocString

A version of this page is also available for

Windows Embedded CE 6.0 R3

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 sz parameter 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 SysAllocString using 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

Reference

Automation Functions
SysFreeString