次の方法で共有


SysAllocStringLen (Windows Embedded CE 6.0)

1/6/2010

This function allocates a new string, copies cch characters from the passed string into it, and then appends a null character.

Syntax

BSTR SysAllocStringLen(
  OLECHAR FAR* pch, 
  unsigned int cch 
); 

Parameters

  • pch
    [in] Pointer to cch characters to copy, or NULL to keep the string uninitialized.
  • cch
    [in] Number of characters to copy from pch.

    A null character is placed afterwards, allocating a total of cch+1 characters.

Return Value

A pointer to a copy of the string indicates success.

NULL indicates that insufficient memory exists.

Remarks

If pch is NULL, a string of the requested length is allocated, but not initialized.

The pch string can contain embedded null characters and does not need to end with a NULL.

Free the returned string later with SysFreeString.

Windows Embedded CE only supports Unicode strings.

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

Requirements

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

See Also

Reference

Automation Functions
SysFreeString