以下程序代码取自<<王国荣 VB6.0 数据库程序设计>>第86页
希望高手能指点,做详细分解,谢谢!!Declare Sub RtlMoveMemory lib "KERNEL32" (LpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)'这个API 函数在VB API Text Viewer 中查不到,它的作用是什么?Sub SavePictureToAdodc (rs As ADODB.Recordset, ByVal FileName As String)
Dim Length As Long, f As Integer
Length=FileLen(FileName) ReDim bArray(Length+12) as Byte, bArray2(Length) As Byte
'为什么bArray要多加12
bArray(0)=&H6C
bArray(1)=&H74
'以上两句有何作用?
RtlMoveMemory bArray(4), Length, 4
'以上一句又有何用?
f=FreeFile
Open FileName For Binary As #f
Get #f, , bArray2
Close #1
RtlMoveMemory bArray(8) , bArray2(0) , Length
rs("相片").AppendChunk bArray
'以上这两句又有何作用?End Sub
希望高手能指点,做详细分解,谢谢!!Declare Sub RtlMoveMemory lib "KERNEL32" (LpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)'这个API 函数在VB API Text Viewer 中查不到,它的作用是什么?Sub SavePictureToAdodc (rs As ADODB.Recordset, ByVal FileName As String)
Dim Length As Long, f As Integer
Length=FileLen(FileName) ReDim bArray(Length+12) as Byte, bArray2(Length) As Byte
'为什么bArray要多加12
bArray(0)=&H6C
bArray(1)=&H74
'以上两句有何作用?
RtlMoveMemory bArray(4), Length, 4
'以上一句又有何用?
f=FreeFile
Open FileName For Binary As #f
Get #f, , bArray2
Close #1
RtlMoveMemory bArray(8) , bArray2(0) , Length
rs("相片").AppendChunk bArray
'以上这两句又有何作用?End Sub
VOID
RtlMoveMemory(
IN PVOID Destination,
IN CONST VOID *Source,
IN ULONG Length
);RtlMoveMemory moves memory either forward or backward, aligned or unaligned, in 4-byte blocks, followed by any remaining bytes.ParametersDestinationPoints to the destination of the move.SourcePoints to the memory to be copied.LengthSpecifies the number of bytes to be copied.CommentsThe (Source + Length) can overlap the Destination range passed in to RtlMoveMemory.Callers of RtlMoveMemory can be running at any IRQL if both memory blocks are resident. Otherwise, the caller must be running at IRQL < DISPATCH_LEVEL.就是移动内存的意思2处bArray多加12是因为后面4,5处要向后移动4+8共bytes,至于第3处只是纯粹的赋值操作