I want to allocate a large array of data "three mega bytes" and I don't know how to do this in VB after allocating this array I want to pass a pointer to it to C++ DLL what is the appropriate pointer knowing that it is not an array of string can I use LPSTR, can anyone help me

I want to allocate a large array of data "three mega bytes" and I don't know how to do this in VB after allocating this array I want to pass a pointer to it to C++ DLL what is the appropriate pointer knowing that it is not an array of string can I use LPSTR, can anyone help me

I use this code but it crashes
Dim BufferSize As Long
Dim BufferPtr As Long
Dim MemoryPtr As Long

BufferSize = FileLen(CommonDialog1.FileName)
MemoryPtr = GlobalAlloc(GMEM_FIXED, BufferSize)
If (MemoryPtr) Then
CopyMemory MemoryPtr, FileNum, BufferSize
end if

Public Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" _
(hpvDest As Any, _
hpvSource As Any, _
ByVal cbCopy As Long)

can anybody help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.