Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7169425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:59:14+00:00 2026-05-28T14:59:14+00:00

I am using an api that has method defined as follows: [DllImport(icsneo40.dll)] public static

  • 0

I am using an api that has method defined as follows:

[DllImport("icsneo40.dll")]
public static extern Int32 icsneoGetMessages(Int32 hObject, ref icsSpyMessage pMsg, ref          Int32 pNumberOfMessages, ref Int32 pNumberOfErrors);

with icsSpyMessage parameter described as:

pMsg [out]
This is the address of the first element of an array of
icsSpyMessage structures. This array will be loaded with
messages received by the hardware. This array must be sized to fit
20,000 icsSpyMessage structures

My question is how do I access the other elements in the array when all I have is the first element?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:59:15+00:00Added an answer on May 28, 2026 at 2:59 pm

    Since you are passing an array you should declare the icsSpyMessage to be an array:

    [DllImport("icsneo40.dll")]
    public static extern Int32 icsneoGetMessages(
        Int32 hObject, 
        [Out] icsSpyMessage[] pMsg,
        ref Int32 pNumberOfMessages, 
        ref Int32 pNumberOfErrors
    );
    

    The [out] attribute instructs the p/invoke marshaller to marshal the native memory back to your managed array of structs. The marshaller will marshal elements according to the length of the managed array.

    So you need to allocate this array before you call the function. The API you are calling requires that you provide an array of at least 20,000 elements.

    icsSpyMessage[] pMsg = new icsSpyMessage[20000];
    Int32 result = icsneoGetMessages(hObject, pMsg, 
        ref pNumberOfMessages, ref pNumberOfErrors);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using an API that has an abstract class that I wish to extend
I’m using an API that has an object that returns IEnumerable<T> , so something
I'm using an API that requires me to pass a function pointer as a
I'm using a Python API that expects me to pass it a function. However,
I have a need to create a transactional process using an external API that
Situation: I need to make an imap client (using java mail api) that if,
I'm developing a API that uses lambda expressions to specify properties. I'm using this
I am trying to read some settings from php.ini using zend. The API that
I understand that using the facebook API I need an api key to connect,
Using the Win32 API (in C, but that's inconsequential), how can I tell if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.