I need to do something with a Unicode string of a tree of a TTreeView, so I want to load this string into a memory stream and then load the memory stream into the tree view. How can I do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You be tempted to use directly the
TStringStreamclass intead of aTMemoryStream. But thisTStringStreamclass will encode the UnicodeString into an AnsiString before storage, in the Unicode Delphi version…So here are some functions to create a
TMemoryStreaminstance with pure Unicode content, then retrieve back this text:Be sure that you
FreetheTMemoryStreamwhen you won’t need it any more.By using
sizeof(Char)andPChar, this code will also work with previous non-Unicode version of Delphi.