VB Code:
  1. 'Declare types and functions
  2. Option Explicit
  3.  
  4. Type SAFEARRAYBOUND
  5.     cElements As Long
  6.     lLbound As Long
  7. End Type
  8.  
  9. Type SAFEARRAY2D
  10.     cDims As Integer
  11.     fFeatures As Integer
  12.     cbElements As Long
  13.     cLocks As Long
  14.     pvData As Long
  15.     Bounds(0 To 1) As SAFEARRAYBOUND
  16. End Type
  17.  
  18. Declare Function VarPtrArray Lib "msvbvm50.dll" Alias "VarPtr" (Ptr() As Any) As Long
  19. Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
  20.  
  21. 'Declare   vars
  22. Public pic() As Byte
  23. Public sa As SAFEARRAY2D
  24.  
  25. 'in a Button_Press Sub:
  26. CopyMemory ByVal VarPtrArray(pic), VarPtrArray(sa), 4
Im getting the error:
"Compile Error
Type mismatch: array or user defined type expected"

after i press OK the variable sa is highlighted from the line
CopyMemory ByVal VarPtrArray(pic), VarPtrArray(sa), 4

anyone have any ideas?