关于 movememory 函数的问题 ,急急急....
我的程序是这样的:
Option Explicit
Private Declare Sub MoveMemory Lib "kernel32" Alias "Rtlmovememory" (destination
As Any, source As Any, source As Any, ByVal length As Long)
Private Sub Command1_Click()
On Error GoTo myerr
CommonDialog1.Filter = "bmp files(*.bmp)|*.bmp"
CommonDialog1.FileName = ""
CommonDialog1.CancelError = True
CommonDialog1.ShowOpen
Dim picfilename As String
If picfilename = "" Then Exit Sub
Dim picfilelen As Long
picfilelen = FileLen(picfilename)
Picture1.Picture = LoadPicture(picfilename)
Dim templen As Long
SavePicture Picture1.Picture, App.Path + "\temp.bmp"
templen = FileLen(App.Path + "\temp.bmp")
Kill App.Path + "temp.bmp"
If picfilelen > templen Then
MsgBox "该经过加密处理,不用再加密了! "
Exit Sub
End If
Dim txtfilename As String
CommonDialog1.Filter = "txtfile(*.txt)|*.txt"
CommonDialog1.CancelError = True
CommonDialog1.FileName = ""
CommonDialog1.ShowOpen
txtfilename = CommonDialog1.FileName
Dim txtfilelen As Long
txtfilelen = FileLen(txtfilename)
Dim mbyte() As Byte
ReDim mbyte(txtfilelen - 1)
Open txtfilename For Binary As 1
Get 1, , mbyte
Close 1
Dim nbyte() As Byte
ReDim nbyte(picfilelen - 1)
Open picfilename For Binary As 3
Get 3, , nbyte
Close 3
ReDim Preserve nbyte(picfilelen + txtfilelen - 1)
MoveMemory nbyte(picfilelen), mbyte(0), txtfilelen
Open picfilename For Binary As 2
Put 2, , nbyte
Close 2
Exit Sub
myerr:
Select Case Err.Number
Case 32755
MsgBox " 请选择一个文件"
Case 53
MsgBox "文件不存在或路径错误"
End Select
End Sub
Private Sub Command2_Click()
On Error GoTo myerr
CommonDialog1.Filter = "bmp files(*.bmp)|*.bmp"
CommonDialog1.FileName = ""
CommonDialog1.CancelError = True
CommonDialog1.ShowOpen
Dim picfilename As String
picfilename = CommonDialog1.FileName
If picfilename = "" Then Exit Sub
Dim picfilelen As Long
picfilelen = FileLen(picfilename)
Picture1.Picture = LoadPicture(picfilename)
Dim templen As Long
SavePicture Picture1.Picture, App.Path + "\temp.bmp"
templen = FileLen(App.Path + "\temp.bmp")
Kill App.Path + "\temp.bmp"
If picfilelen = templen Then
MsgBox "该文件还没有经过加密处理!"
Exit Sub
End If
Dim txtfilename As String
Dim txtfilelen As Long
CommonDialog1.Filter = "txt files(*.txt|*.txt)"
CommonDialog1.CancelError = True
CommonDialog1.FileName = ""
CommonDialog1.ShowSave
txtfilename = CommonDialog1.FileName
Dim txtfilelenas As Long
txtfilelen = picfilelen - templen
Dim mbyte() As Byte
ReDim mbyte(txtfilelen - 1)
Dim nbyte() As Byte
ReDim nbyte(picfilelen - 1)
Open picfilename For Binary As 3
Get 3, , nbyte
Close 3
MoveMemory mbyte(0), nbyte(templen + 1), txtfilelen
Open txtfilename For Binary As 2
Put 2, , mbyte
Close 2
Exit Sub
myerr:
Select Case Err.Number
Case 32755
MsgBox "请选择一个文件"
Case 53
MsgBox "文件不存在或路径错误"
End Select
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Picture1.Visible = False
End Sub
调试时说编译错误,参数不可选 光标停在movememory处,代码是打进去的,api 浏览器中找
不到movememory
挺急的 还请多多帮忙:)
===================================================================