SysReAllocStringLen

HRESULT SysReAllocStringLen( 
  BSTR FAR*  pbstr,  
  OLECHAR FAR*  pch, 
  unsigned int  cch  
);
 

Creates a new BSTR containing a specified number of characters from an old BSTR, and frees the old BSTR.

Parameters

pbstr
Pointer to a variable containing a BSTR.
pch
Pointer to cch characters to copy, or Null to keep the string uninitialized.
cch
Number of characters to copy from pch. A null character is placed afterward, allocating a total of cch+1 characters.

Return Value

Returns True if the string is reallocated successfully, or False if insufficient memory exists.

Comments

Allocates a new string, copies cch characters from the passed string into it, and then appends a null character. Frees the BSTR referenced currently by pbstr, and resets pbstr to point to the new BSTR. If pch is Null, a string of length cch is allocated but not initialized.

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

QuickInfo

  Windows NT: Use version 3.1 and later.
  Windows: Use Windows 95 and later.
  Header: Declared in oleauto.h.
  Import Library: Link with oleaut32.lib.