` Printed Icetips Article

Icetips Article



Windows API: How to create and pass arrays as a string
2003-06-05 -- Vadim Nikitin
 
Newsgroups: softvelocity.products.c55ee

I have seen several interesting variants. Offer one more
(without copying of possible big group)


tGrp      GROUP, TYPE
l1          LONG
l2          LONG
l3          LONG
l4          LONG
          END

pGrp      &tGrp
pBuffer   &STRING
Count     LONG
idx       LONG, AUTO

  CODE
  Count = ...
  pBuffer &= NEW(STRING(SIZE(tGrp) * Count))

  ! over all elements in the array
  LOOP idx = 1 TO Count
    pGrp &= ADDRESS(pBuffer) + SIZE(tGrp) * (idx - 1)
    pGrp.l1 = idx
    pGrp.l2 = idx * 10
    pGrp.l3 = idx * 100
    pGrp.l4 = idx * 1000
    ! API call
    ! Use ADDRESS(pBuffer) for pathing entire array
    ! Use ADDRESS(pGrp) for pathing one element by value
  END
  DISPOSE(pBuffer)



Printed May 3, 2024, 1:56 am
This article has been viewed/printed 35110 times.
Google search has resulted in 15 hits on this article since January 25, 2004.