Results 1 to 4 of 4

Thread: Marshal to pass a long pointer to an array of short?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Marshal to pass a long pointer to an array of short?

    How do I pass a variable length array of short values to an API call? I have tried
    VB Code:
    1. <MarshalAs(UnmanagedTypes.LPArray)>pFields() As Short
    but it generates a loadlibrary exception...

    Any ideas?

    Thanks in advance,
    Duncan

  2. #2
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    Have you tried using a fixed length array?

    Code:
    <MarshalAs(UnmanagedType.LPArray, SizeConst=10)>pFields() As Short
    /Leyan

  3. #3
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    Unfortunately the array is variable length at run time....
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  4. #4
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    ok, but just to see the result, is it possible for you to test if it works with a fixed length array?

    Some situation requires a fixed length array, that would help us see if that might be the case for you.

    /Leyan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width