メモリ内容の複写
メモリの内容を複写するAPIです。 RtlMoveMemory() API 以下にサンプルを紹介します。 このサンプルをフォームモジュールに貼り付けて実行して見てください。 *----*----*----*----*----*----*----*----*----*----*----*----*----* Option Explicit Private Type POINTAPI x As Long y As Long End Type Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Dest As Any, ByVal lpSrc As Long, ByVal Length As Long) Private Sub Form_Click() Dim pts As POINTAPI, ptd As POINTAPI pts.x = 127 pts.y = 63 CopyMemory ptd, VarPtr(pts), LenB(ptd) MsgBox "ptd.x=" & ptd.x & " ptd.y=" & ptd.y End Sub このAPIを使わずVbの代入文でも同じ事が行えます。 ptd.x = pts.x ptd.y = pts.y または ptd = pts |
動作確認
Windows98 Second Edition + Visual Basic 6このサンプルを使用しての感想や、質問は 掲示板や、 らくがき帳に書きとめて頂けるとうれしいです。