小说网 找小说 无限小说 烟雨红尘 幻想小说 酷文学 深夜书屋

计算数组的维数

Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, source As Any, ByVal Length As Long)

Private Const VT_BYREF = &H4000&

Private Sub Command1_Click()
Dim S(6, 12, 24, 36, 48) As Single
MsgBox Dimensions(S)
End Sub

Function Dimensions(ByRef MYARRAY) As Integer
Dim VTYPE As Integer, LP As Long
CopyMemory VTYPE, MYARRAY, 2
CopyMemory LP, ByVal VarPtr(MYARRAY) + 8, 4
If (VTYPE And VT_BYREF) Then CopyMemory LP, ByVal LP, 4
CopyMemory Dimensions, ByVal LP, 16
End Function

返回 5

posted on 2006-04-24 09:42  王峰炬  阅读(125)  评论(0编辑  收藏  举报

导航