CString::AllocSysString

BSTR AllocSysString ( ) const;
throw( CMemoryException );

Return Value

Points to the newly allocated string.

Remarks

Allocates a new OLE Automation–compatible string of the type BSTR and copies the contents of the CString object into it, including the terminating null character. A CMemoryException is thrown if insufficient memory exists. This function is normally used to return strings for OLE Automation.

Use ::SysFreeString in the rare case that you need to deallocate the returned string.

Note   You must link with MFCO42D.DLL to obtain this function if you are using MFC in a shared library and building in debug mode. You can cause the linker to get MFCO42D.DLL automatically by including <afxdisp.h> in your STDAFX.H file.

For more information about OLE allocation functions in Windows, see ::SysAllocString and ::SysFreeString in the Win32 SDK OLE Programmer’s Reference.

CString OverviewClass MembersHierarchy Chart

See Also   ::SysAllocString, ::SysFreeString, CMemoryException