'前面自己加选择文件的代码,例如文件路径存放于mstrFile内。
private type DATA_INFO
strFileName as string
strPath as string '(如果你想解到别的路径下,可以定义一系列宏)
lFileLen as long
end type
private sub AddFile
dim iFile as integer
dim iDestFile as integer
dim bytBuffer() as byte
dim strDestPath as string
dim FileInfo as FILE_INFO
if dir(mstrFile)<>"" then
redim bytbuffer(filelen(mstrfile))
FileInfo.strFIlename='filename
FileInfo.lFileLen=filelen(mstrfile)
iFile=freefile
open mstrfile for binary access read as ifile
idestfile=freefile
open strdestpath for binary access write as idestfile
get ifile,,bytbuffer
put idestfile,,fileinfo
put idestfile,,bytbuffer
close idestfile
close ifile
endif
ens sub
另:程序一有点问题,应该是:
dim FileInfo as FILE_INFO
open App.Path & "\" & app.exename & ".exe" for binary access read as ifile
get ifile,,FileInfo
redim bytBuffer(FileInfo.lFIlelen)
...
private mlFileCount as long
private type DATA_INFO
strFileName as string
strPath as string '(如果你想解到别的路径下,可以定义一系列宏)
lFileLen as long
end type
private sub ExtractData
dim iFile as integer
dim iDestFile as integer
dim strDestPath as string
dim bytBuffer() as byte
dim lFileLen as long
ifile=freefile
open App.Path & "\" & app.exename & ".exe" for binary access read as ifile
get ifile,,lfilelen
iDestFIle=freefile
open strDestPath for binary access write as idestfile
redim bytbuffer(lfilelen-1)
get iFile,,bytbuffer
put idestfile,,bytbuffer
close idestfile
close ifile
end sub