473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

converting variants that contain safe arrays of variants

J
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
objects.

_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];
swprintf(szLine,L"Line:%d
Name:%s",varLineNumber.uintVal,varLineName.bstrVal );
MessageBox(szLine);
}

Nov 28 '05 #1
0 953

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: matt melton | last post by:
Hi there, I am trying to write a method that accepts an array of any primitive type and will return the same array without copying memory as an array of bytes. ie. I'd like to be able to do...
3
by: Peter | last post by:
Hi, I was wondering how do you compare variables that contain text strings in ASP. When I use the following If.. Then statement: If Rs("StyleNo") <> arrStyleNo(aCount) Then
4
by: Cyde Weys | last post by:
I'm currently working on converting a simulator program from Visual Basic 6.0 to Visual C++ .NET. I've figured out most of the stuff, but there's still one thing I haven't gotten to and I've never...
36
by: Robert Vazan | last post by:
I am looking for other people's attempts to create safe subset of C and enforce it with scripts. Does anybody know about anything like this? By "safe", I mean the following: * Strongly typed...
3
by: Pete Davis | last post by:
I've never done this in C# so I don't know what the appropriate way of doing it is. I've got an array of bytes and I need to convert the array into "usable" data. For example, the first 4 bytes...
24
by: cs_hart | last post by:
I have an application in Java that I would like to port to c++ to integrate with existing c++ app. Is anyone aware of any tools to help? I found microsft has a java->c# convert, but the java app...
9
by: Paul M. Cook | last post by:
OK guys, this is my first real attempt at VB. Actually my return to writing programs since 1998. I've got an old DOS QB app that I am converting to VB 6.0. Really simple file formatting app. ...
156
by: Lame Duck | last post by:
Hi Group! I have a vector<floatvariable that I need to pass to a function, but the function takes a float * arguement. That's OK, I can convert by doing &MyVector.front(), but when I get back a...
15
by: itdevries | last post by:
Hi, I'm trying to read some binary data from a file, I've read a few bytes of the data into a char array with ifstream. Now I know that the first 4 bytes in the char array represent an integer....
9
by: Slain | last post by:
I need to convert a an array to a multidimensional one. Since I need to wrok with existing code, I need to modify a declaration which looks like this In the .h file int *x; in a initialize...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.