Skip to content

Instantly share code, notes, and snippets.

@kumatti1
Created May 13, 2015 21:31
Show Gist options
  • Save kumatti1/6236e7dc31d3cdd5311c to your computer and use it in GitHub Desktop.
Save kumatti1/6236e7dc31d3cdd5311c to your computer and use it in GitHub Desktop.
配列の初期化チェック
Option Explicit
Private Declare PtrSafe _
Function VarPtr Lib "vbe7.dll" ( _
ByRef arr() As Any _
) As LongPtr
Private Declare PtrSafe _
Sub RtlMoveMemory Lib "Kernel32.dll" ( _
ByRef Destination As Any, _
ByRef Source As Any, _
ByVal Length As LongPtr _
)
Sub hoge()
#If Win64 Then
Dim arr() As LongPtr
Dim pp As LongPtr
Dim p As LongPtr
pp = VarPtr(arr)
RtlMoveMemory p, ByVal pp, 8
If p Then
Debug.Print "初期化済み"
Else
Debug.Print "未初期化"
End If
#End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment