"George" <George@discussions.microsoft.com> wrote in message
news:C8211754-227B-4CF3-A7A6-255650D80F05@microsoft.com
For the SysAllocString API, I am wondering,
1. any special benefits if we use SysAllocString compared with using a
simple wide character string, like L"Hello"?
Some COM APIs require a properly allocated BSTR and won't work with a
string literal. Having a working program, rather than a crashing one,
appears to me to be a pretty substantial benefit.
2. If we use SysAllocString to allocate constant string
This statement makes no sense to me. What do you mean, allocate constant
string?
SysAllocString uses its own memory allocator. Any BSTR you've allocated
with SysAllocString (or similar) should be deallocated with
SysFreeString (similar to malloc() and free() ).