高分求助!!实用代码求分析!!!浏览者受益!!指点者获高分!!

vbcool 2003-08-23 11:05:07
以下程序代码取自<<王国荣 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
...全文
57 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lazycat818 2003-08-26
  • 打赏
  • 举报
回复
这段代码的作者有点故弄玄虚,简直误人子弟!
lazycat818 2003-08-26
  • 打赏
  • 举报
回复
RtlMoveMemory也许被声明为CopyMemory。
cboy2wzhx 2003-08-25
  • 打赏
  • 举报
回复
From CSDN:

RtlMoveMemory
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.

Parameters

Destination

Points to the destination of the move.

Source

Points to the memory to be copied.

Length

Specifies the number of bytes to be copied.

Comments

The (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处只是纯粹的赋值操作
vbcool 2003-08-23
  • 打赏
  • 举报
回复
感谢changechange,但是我只想求得这代码的分析和运行原理,还希望你能针对该代码给以指点,再此感谢
changechange 2003-08-23
  • 打赏
  • 举报
回复
http://klz.myrice.com/program/vb/vb004.htm
vbcool 2003-08-23
  • 打赏
  • 举报
回复
这段程序我已分析多遍,只因孤陋寡闻,多处不解其意,至今不知其运行原理,望能各位指点一二,谢
vbcool 2003-08-23
  • 打赏
  • 举报
回复
本人对数据库初了解,希望来客多多指点!!

4,011

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧