Results 1 to 5 of 5

Thread: Passing a VB Byte Array into a C++ DLL

  1. #1

    Thread Starter
    Member
    Join Date
    May 2002
    Location
    Great Britain
    Posts
    60

    Passing a VB Byte Array into a C++ DLL

    Can someone give me an example of how I can pass an array of Bytes (from VB) into a C++ DLL?
    I know I've got to pass the length of the array, as well as the first array element (I think?). But I would appreciate an example to work from.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    void __stdcall PassArrayTo(char *ar, long length);

    Declare Sub PassArrayTo ... (ByVal ar as Long, ByVal len As Long)

    'Call:
    PassArrayTo VarPtr(array(1)), UBound(array)
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Member
    Join Date
    May 2002
    Location
    Great Britain
    Posts
    60
    Does that require the VB Array to be of type 'long'?

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No. It's Long because Long has the same size as a pointer. The return value of VarPtr is Long.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Member
    Join Date
    May 2002
    Location
    Great Britain
    Posts
    60
    thanks... sorry you had to tell me twice!

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