Re: Byte Array aus C++ DLL in VB importieren



Hallo,

in C++ ist der Name eines Arrays schon die Adresse des ersten Elements - es
sollte also heißen:

RtlMoveMemory(bpLampAdressSet, bLamp, 175);

Was sonst noch alles falsch ist kann ich jetzt aus dem Stehgreif nicht
beurteilen. In VB vielleicht explizit ByRef angeben - aber das müßte
eigentlich automatisch gesetzt sein.

Gruß
Thomas


"Friedemann Wolpert" <apslive@xxxxxxx> schrieb im Newsbeitrag
news:uAYnkTqRIHA.5360@xxxxxxxxxxxxxxxxxxxxxxx
Hi !

Ich versuche seit 3 Tagen erfolglos einen einfachen Byte Array aus einer
C++ DLL in VB zu importieren. So langsam weiss ich nicht mehr weiter.

C++ Teil:

// *cLampAdressSet is first Element of my VB Byte Array passed byRef
// So use the VB Byte Array instead of the C++ one

STDMETHODIMP CEZrgb8::SetDotMatrix(byte *bpLampAdressSet){

//bpLampAdressSet = new byte[176];
//bpLampAdressSet = &bLamp[0];
RtlMoveMemory(bpLampAdressSet, &bLamp, 175); // tut alles nicht

return 0;
}

das ganze wird so an die DLL übergeben von VB aus:

Dim lTestArray(175) As Byte
lResult = SetDotMatrix(lTestArray(0))

In der C++ DLL gibt es einen Byte Array bLamp[176] , den benötige ich am
besten als Zeiger quasi in Visual Basic.


Bin über jede Hilfe Dankbar.



.



Relevant Pages

  • Re: VC++ AND DLL
    ... HERE DOUBLE ARRAY IS PASSED FROM VB TO VC++ DLL ... Private Declare Sub MyCFunc Lib "MyCDLL.dll" (ByRef X as double) ...
    (microsoft.public.vb.winapi)
  • Re: VB .Net and Intel Visual Fortran 9
    ... Integer, ByRef k As Long) ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub stest Lib "test.dll" (ByVal i As Integer, ...
    (comp.lang.fortran)
  • Re: D3 odbc and .Net, almost there!
    ... that he was passing values ByVal instead of ByRef in his VB.NET code, ... The DLL itself follows well known standards ... as the parameters are correct it will work because the standards for calling ... there is no reason that code shouldn't work properly. ...
    (comp.databases.pick)
  • Re: Functions: Passing multiple values
    ... I'll try it and see how the calculations react to the pointers. ... I hadn't thought of using ByRef in this case. ... > Public Sub myFunction (byRef iAddDays as Integer, ... >> Is As Array correct or should it be As Integer? ...
    (microsoft.public.dotnet.languages.vb)
  • Problem marshalling two-dimensional array in structure
    ... ByRef composition As composition_data, ByRef curve As curve_data) As Long ... I have tried with and without different MarshalAs directives with no success. ... It seems that the two-dimensional array is the problem. ...
    (microsoft.public.dotnet.framework.interop)