Re: passing BYTE array pointer in vb.net

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Paul G. Tobey [eMVP] (ptobey_no_spam_at_instrument_no_spam.com)
Date: 02/04/04


Date: Wed, 4 Feb 2004 15:34:18 -0700

Are you sure that the byte array you are passing is the size you've
indicated to the function? That's the only thing I see there.

Paul T.

"Dante" <anonymous@discussions.microsoft.com> wrote in message
news:365F3B0A-DF1F-4A4B-B676-498D6652F346@microsoft.com...
> I need to call a function from within VB.net to a function in a dll writen
in c++ that looks like this in the c++ driver:
> extern "C" BOOL USBDownloadPictureData(BYTE *buffer, DWORD Size)
> {
> ...
> }
>
> in VB.net, my dll import looks like this:
> <DllImport("camera.dll")> _
> Function USBDownloadPictureData(ByRef buffer As Byte(), ByVal Size As
Int32) As Int32
> End Function
>
> everytime i call this from VB.net, i get a native exception error. I have
other functions from the same dll that i call with no problem that don't
have a BYTE array pointer in it's arguments, So the problem is passing the
pointer from VB.net to unmanaged c++. Anyone know how to do this?
>
>
>
>
>



Relevant Pages

  • Re: Problem closing app with big UDT
    ... Are you trying to pass the UDT between VB and Delphi, or do you just mean that the Delphi equivalent works fine? ... All the array sizes are multiples of 4, so the 4-byte alignment should be maintained throughout unless we screwed up somewhere. ... We didn't think of passing the whole thing as a byte array, and it's too late to go back and rework it now. ... In any one app, maybe, but this dll is in production use in several different apps, in 3 different languages. ...
    (microsoft.public.vb.general.discussion)
  • Passing a SAFEARRAY of BSTRs between a C++ DLL and VB 2008
    ... I am having a problem in passing a SAFEARRAY of BSTRs from a C++ DLL to a VB ... I am able to pass an array of doubles without any issue. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Reading a Range from a VB6 DLL
    ... Another option is to pass the Excel application as an object to the dll and ... categorize it and put it into an array. ... passing the no of rows and columns as a long/iinteger respectively. ...
    (microsoft.public.excel.programming)
  • passing arrays to actxServer
    ... Matlab as an actxServer. ... I am successful in passing most ... parameters from Matlab to the methods of the .dll, ... Attempt to reference field of non-structure array. ...
    (comp.soft-sys.matlab)
  • Re: Is a Thread appropriate?
    ... >> Now, if you are not doing dynamic loading of the DLL, you shouldn't need GetProcAddress. ... >> Note that it is foolish to create a char array, particularly a char array of a fixed size. ... >> If you need to declare a separate variable, ... without necessity. ...
    (microsoft.public.vc.mfc)