|
-
February 5th, 2009, 09:34 AM
#1
How to read elements in a VARIANT
Hi,
I can not find out how to read what is in a VARIANT, which is the result of calling a method GetAllProperties. The doc of this method only specifies that a VARIANT is returned. It should contain some kind of strings. I tried this :
VARIANT names;
_variant_t v1;
VARTYPE vtype;
long ix;
...
x->GetAllProperties(&names);
if (V_ISARRAY(&names)) {
SafeArrayGetVartype(names.parray,&vtype);
// this returns 0x0800 in vtype, so I assume it is an array of _variant_t !!!
for (ix=0;ix<nprops;ix++) {
SafeArrayGetElement(names.parray,&ix,&v1);
_bstr_t s1(v1);
printf("name=%s\n",(char *)s1);
}
}
But this ends in an exception during the statement "_bstr_t s1(v1);"
What do I do wrong ???
Linde Ackermans
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|