Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 722
  • Last Modified:

COM Array (CComSafeArray::MultiDimGetAt)

I have a COM array of doubles of type CComSafeArray, say with 10 rows and 30 columns. I simply need to retrieve its elements one by one and print them out on the screen. How do I do this with MultiDimGetAt? I have read the Microsoft documentation available on the MSDN website but it's not very clear to me, and I don't know much about COM.
Thanks.
0
Rothbard
Asked:
Rothbard
  • 5
  • 2
1 Solution
 
Jase-CoderCommented:

for(int i=0; i < 10; i++)
{
    Array->GetAt(i, &Data);
    cout << Data;
}
0
 
RothbardAuthor Commented:
What is Data in your code? Also, since our Array has two dimensions wouldn't you need MultiDimGetAt rather than GetAt?
0
 
Jase-CoderCommented:
sorry ignore the above: do

LONG Index[2];

for(int i=0; i< 10; i++)
   for(int j=0; j < 3; j++)
{
      Index[0] = i;
      Index[1] = j;
     
      Array->MultiDimGetAt(Index, Data);
      cout << Data << endl;
}
     

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Jase-CoderCommented:
Data is declared the same as the elements in your array.
0
 
Jase-CoderCommented:
In your case declare Data as double
0
 
Jase-CoderCommented:
change for(int j=0; j < 3; j++) to for(int j=0; j < 30; j++)
0
 
RothbardAuthor Commented:
Thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now