.NET Framework 類別庫這是微軟上的MSDN範例
由這buffer位移,表示VB能處理更低階的工作了(有點跟組合語言一樣ASM);但要運用必須瞭解位移的方式和特性
底下依原例,稍調整並呈現數據出來;方便研究!!
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim src() As Short = {258, 259, 260, 261, 262, 263, 264, _
265, 266, 267, 268, 269, 270}
Dim dest() As Long = {17, 18, 19, 20}
' src: 010E 010D 010C 010B 010A 0109 0108 0107 0106 0105 0104 0103 0102
' dest: 0000000000000014 0000000000000013 0000000000000012 0000000000000011
' 未位移前的陣列內容
For i As Integer = 0 To UBound(src)
For j As Integer = 0 To UBound(dest)
ListBox1.Items.Add("S:" & Hex(src(i)) & " D:" & Hex(dest(j)))
Next
Next
' 執行位移陣列和內容
Buffer.BlockCopy(src, 5, dest, 7, 6)
Buffer.BlockCopy(src, 16, dest, 22, 5)
Buffer.BlockCopy(src, 4, src, 5, 7)
Buffer.BlockCopy(src, 16, src, 15, 7)
For i As Integer = 0 To UBound(src)
For j As Integer = 0 To UBound(dest)
ListBox2.Items.Add("S:" & Hex(src(i)) & " D:" & Hex(dest(j)))
Next
Next
' src: 010E 010D 0D01 0C01 0B01 0A09 0108 0701 0601 0501 0404 0103 0102
' dest: 00000000000C010B 010A000000000013 0000000701060105 0100000000000011
End Sub
End Class
--用圖來一下--
沒有留言:
張貼留言