-
SysAllocString
Hello everyone,
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"?
2. If we use SysAllocString to allocate constant string, then does SysAllocString allocate the constant string on heap, stack or on the constant string pool?
thanks in advance,
George
-
SysAllocString, according to what I understand from the page below, is a OLE function.
http://msdn2.microsoft.com/en-us/library/ms221458.aspx
It would certainly allocate from A heap - whether it's "the" heap or "some other" heap.
--
Mats
-
As for the difference to a normal wide character string, the OLE string has the length stored prior to its start. It thus may contain embedded NULs, and is faster to work with for many tasks.
-
If you want to use SysAllocString, you would be better off using CComBSTR in the C++ world.
You shouldn't ever need to use SysAllocString directly, in C++.