2009年6月10日水曜日

要素数が0の配列(Vb6.0)

1.要素数が0の配列の作成
'/ 未割り当ての状態を取得 (メソッド内は空でもいい)
Public Function GetNothing() As String()
 Dim stNullable() As StringGetNothing = stNullable
End Function
'/ 配列 0 の状態を取得
Public Function GetEmpty() As String()
 GetEmpty = Split(vbNullString, vbNullChar)
End Function

2.0要素の配列のチェック
'/* MyStrings モジュール */
Option Explicit
Private Declare Sub GetMem4 Lib "MSVBVM60.DLL" ( _
ByRef aParam() As Any, _
ByRef lCount As Long _
)
'/ Is Nothing の代わり
Public Function IsNothing(ByRef stArgs() As String) As Boolean
 Dim lCount As LongCall GetMem4(stArgs, lCount)
 If lCount = 0 Then
  IsNothing = True
 Else
  IsNothing = False
 End If
End Function

0 件のコメント:

コメントを投稿