Announcement

Collapse
No announcement yet.

multidimensional arrays from VB to PB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Geoff Adams
    Guest replied
    Semen

    thanks for your suggestion - this works nicely!

    Geoff

    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    Geoff --
    I think that to use descriptors is incorrect way.
    So, for me it looks better to do something like this

    Vb
    Code:
    DefLng A-Z
    Private Declare Sub Pb Lib "PbA" (ByRef Ar As Long, m1 As Long, m2 As Long, n1 As Long, n2 As Long)
    Private Sub Form_Load()
       m1 = 2: m2 = 6: n1 = 4: n2 = 8
       ReDim Ar(m1 To m2, n1 To n2)
       For i = m1 To m2: For j = n1 To n2
          Ar(i, j) = 100 * i + j
       Next: Next
       Pb Ar(m1, n1), m1, m2, n1, n2
       End
    End Sub
    Pb
    Code:
    #Compile Dll "F:\WinNt\System32\PbA.Dll" '<--- Change
    #Register None
    #Dim All
    #Include "win32Api.Inc"
    
    Sub Pb Alias "Pb" (ByVal ArPtr As Long Ptr, m1 As Long, m2 As Long, n1 As Long, n2 As Long) Export
       Dim i As Long, j As Long, s As String
       ReDim Ar(m1 To m2, n1 To n2) As Long At ArPtr
       For i = m1 To m2
          s = "": For j = n1 To n2: s = s + Str$(Ar(i, j)): Next: MsgBox s
       Next
    End Sub
    ------------------

    Leave a comment:


  • Geoff Adams
    Guest started a topic multidimensional arrays from VB to PB

    multidimensional arrays from VB to PB

    I have read Dave Navarros FAQ on passing arrays from VB to PB. However this only seemed to cover 1D arrays.

    I have to pass some 2 & 3D arrays to PB. Any advice on how to do this?

    thanks
Working...
X