KCC dream to passing an string array VB or PB in DLL, and modify it into a DLL for return in VB or PB
This job seem simple in the first see...but KCC eat several box of sedative for sleep, since he have begin this code

Despite that several help of SROD, IDLE, CPLBATOR, XOMBIE, GEBONET and perhaps other that i thanks again all

This time and the first time since 4 years...KCC walk on the same place and tourn around

The more strong is obviously VB

With his BSTR array

So with the precious help of SROD, KCC retry one of his method and probably the best and more simple.
The passing of pointers of array.
So i follow the advice of my master

KCC begin at the beginning, and restart at zero.
It's the more simple.....
And oouuuinnnnn arrreeeuuu !!!! arrreeuuuuu oouuuinnnnn arreeeuu !!!!
Huummmm Huummmm !!! perhaps KCC have beginning a little bit too much at zero :roll:

So i say after several years.....And i try to move step by step, like this, you can help KCC if you want, before that the code is too complex to read

It's a little bit like if KCC open a association "save willy" but here it's "save KCC"

Like the most hard is the passing VB/DLL i begin by that :roll:
KCC have rewrite a piece of VB and PB code for passing the BSTR array VB at the DLL
That's works.....
For a better understanding, KCC have translate all his functions in english

VB code
Code: Select all
Private Declare Function ModifyArray Lib "DLLArray.dll" (PointerArray As Long) As Long
Private Sub Form_Load()
Dim ArrayString(10) As String
ArrayString(0) = Trim(Str(UBound(ArrayString)))
For i = 1 To 10
ArrayString(i) = "Sentence " + Str(i)
Next
Dim AdresseArrayPointers() As Long
AdresseArrayPointers = ArrayString2ArrayPointer(ArrayString)
ModifyArray AdresseArrayPointers(0)
End Sub
Public Function ArrayString2ArrayPointer(ArrayString() As String) As Variant
Dim MaxArray As Integer, ArrayPointer() As Long
MaxArray = UBound(ArrayString)
ReDim ArrayPointer(MaxArray) As Long
ArrayPointer(0) = MaxArray
For i = 1 To MaxArray
ArrayPointer(i) = StrPtr(ArrayString(i))
Next
ArrayString2ArrayPointer = ArrayPointer
End Function
Code: Select all
Procedure ArrayBstr2Ansi(*AdresseTabloBSTR)
SizeOfArray.l = PeekL(*AdresseTabloBSTR)
Dim ArrayPointersInfoSoft(SizeOfArray)
Static Dim ArrayANSI.s(1000)
CopyMemory(*AdresseTabloBSTR + 4, @ArrayPointersInfoSoft(), SizeOfArray * 4)
For i = 0 To SizeOfArray - 1
If ArrayPointersInfoSoft(i) <> 0
*BSTR = ArrayPointersInfoSoft(i)
lenBSTR = PeekL(*BSTR - 4) / 2
Dim Char.c(lenBSTR)
For u = 0 To lenBSTR
Char(u) = PeekC(*BSTR + u * 2)
Next
ArrayANSI(i + 1) = PeekS(@Char(0))
Else
ArrayANSI(i + 1) = " "
EndIf
Next
ReDim ArrayANSI(i)
ProcedureReturn ArrayANSI()
EndProcedure
ProcedureDLL ModifyArray(*PointerArray)
Static Dim ArrayANSI.s(0)
ArrayANSI() = ArrayBstr2Ansi(*PointerArray)
For i = 1 To ArraySize(ArrayANSI())
TabloVB$ + ArrayANSI(i) + Chr(13)
Next
MessageRequester("Try", TabloVB$)
EndProcedure
I continue to search
Tanks to have read up till here

Good day at all