471,317 Members | 1,776 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

converting variants that contain safe arrays of variants

Can anybody tell me how to convert the following code from C++ to C#. C#
receives the paramerters as object's from the COM interface and I have been
unable to find anything that clearly identifies how to extract the data from

_variant_t varLineNumbers,varLineNames;
if (S_OK!=svc->GetLineList(&varLineNumbers,&varLineNames))
return false;

CComSafeArray<VARIANT> saLineNumbers(*(varLineNumbers.parray));
CComSafeArray<VARIANT> saLineNames(*(varLineNames.parray));
ULONG ulCount = saLineNumbers.GetCount();
for (ULONG ul=0;ul<ulCount;++ul)
// Order of information return is name and then value
CComVariant varLineNumber = saLineNumbers.GetAt(ul);
CComVariant varLineName = saLineNames.GetAt(ul);

WCHAR szLine[0xff];
Name:%s",varLineNumber.uintVal,varLineName.bstrVal );

Nov 28 '05 #1
0 925

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by matt melton | last post: by
36 posts views Thread by Robert Vazan | last post: by
3 posts views Thread by Pete Davis | last post: by
24 posts views Thread by cs_hart | last post: by
156 posts views Thread by Lame Duck | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.