Strings in Automation ATL/COM/OLE


I am still trying to get help with my orignal question so....

In automations where the doc says string as in the case WorkBooks::OpenText

1) the string is formated as VT_BSTR

when I look in memory at my file name there is 1 by of X'00' between every character

C X'00' : X'00' \ X'00' etc etc
This is the correct format of VT_BSTR
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hm - what is the question?
JoereichmanAuthor Commented:
The filename first parameter is a string I believe LPCSTR this gets converted to a VT_BSTR

what is the format of a VT_BSTR string in automation
The VT_BSTR in fact is a VARTYPE which indicates a BSTR is used in an VARIANT.

OLE/Automation strings use BSTR which is described i.e. here:

In short: The BSTR first has a 4 bytes as length inidcator followed by UNICODE characters and two 0 (UNICODE-) characters as terminator.

Hope that helps,

JoereichmanAuthor Commented:
I have looked at the string Filename and it does fit a BSTR format 4 byte length with a null byte in between each character
Yes, that's exactly what I wrote above. What you see as NULL byte between each character is simply a UNICODE string where each character is a WCHAR which is a 16 byte value.

Please tell if you have further questions ...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.