"Claus77" <cm******@web.dewrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...
Hi there,
I've got a little problem with the following:
I'm just writing a com-application in C++ with VS-6, which should also
be
used with VB-Script, so I have to use variables of type VARIANT in my
functions in order to get no problems with VB-Script.
I try to transform them into C++-Variables somehow like this:
function a(VARIANT var)
bstr ch = var.bstr;
In the definition of VARIANT you gave me, there is no bstr. So how can you
be using var.bst if bstr is not defined within VARIENT?
In the definition of bstr you gave me, it is a wchar_t*, or a wide char
pointer. So it would seem that you are assinging the pointer ch to point to
whatever bstr is, which is probably another wchar_t. You haven't copied
anything though.
You need to look at thwat bstr is pointing to, the text string I'm fairly
sure, but is it null terminated? If not, you need to get the length out of
your var and determine how long it is.
So basically what you want to do is copy the text that bstr is pointing to
into some C++ type string. I would probably go with a std::string, but you
could go with a char array. Then copy the contents. Since you haven't
given me a full defintion of VARIANT I can't help you with where the length
is stored in VARIANT.
Consider asking in a windows newsgroup if you can't figure it out.
But C++ only puts the first character of the string into my variable
ch... Why?
What have I done wrong?
Thanks for your help,
Claus