wchar

WinFBX

wchar

CBSTR Class ››
Parent Previous Next

Description

Returns the string data as a new unicode string allocated with CoTaskMemAlloc.


Syntax


FUNCTION wchar () AS WSTRING PTR


Remarks


The new string must be freed with CoTaskMemFree.


Useful when we need to pass a pointer to a null terminated wide string to a function or method that will release it. If we pass a WSTRING it will GPF. If the length of the input string is 0, CoTaskMemAlloc allocates a zero-length item and returns a valid pointer to that item. If there is insufficient memory available, CoTaskMemAlloc returns NULL.


Usage example


DIM cbs AS CBSTR = "Test string"

DIM pwchar AS WSTRING PTR = cbs.wchar

PRINT *pwchar

CoTaskMemFree pwchar


Include file


CWStr.inc


Created with the Personal Edition of HelpNDoc: Free PDF documentation generator