这个好像有点意思:)想想I am thinking....

解决方案 »

  1.   

    TopHead 
    数据文件是自己写的了专用的文件
      

  2.   

    这个问题我见过!有人写过!
    不过现在记不得在哪看到的了!
    最后好象要copy a+b c合成一个文件!在程序中
    读B时,把文件指针移到a的大小+1处!就是B的开始处
      

  3.   

    我做过一个自解压的。实际上就是一个脱壳程序。首先,你要先把你的exe编译出来,看它有多大,存为一个常量。再另外做一个程序,专门进行合并。如:
    程序一(解包)
    private const MYLENGTH=23560private mlFileCount as long
    private type DATA_INFO
        strFileName as string
        strPath as string    '(如果你想解到别的路径下,可以定义一系列宏)
        lFileLen as long
    end typeprivate 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
      

  4.   

    程序2   (打包程序)'前面自己加选择文件的代码,例如文件路径存放于mstrFile内。
    private type DATA_INFO
        strFileName as string
        strPath as string    '(如果你想解到别的路径下,可以定义一系列宏)
        lFileLen as long
    end typeprivate 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
        endifens 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)
    ...哎,对于这道题来说,分太少了点。我以前花了一下午才写出来。:)
    要想加多个文件,改为数组,再在添加文件时把数据文件数量先写进去。
    有问题再问我吧
    祝,成功!
      

  5.   

    呵呵,liyang佩服佩服,问一句程序2生成的打包后的文件能自解开吗?
      

  6.   

    tophead:
    你也很厉害呀。回答不少难题。最近来了bluewater,也是个很厉害的高手.
    可以的。程序一就是这个自解放的exe.
    试过,exe在执行时可以对自己进行读操作。我原来不知道,试过了,才晓得。
      

  7.   

    是啊。winzip 的self extractor!
      

  8.   

    liyang:
      你好!
      感谢你对我的文章的回复!
      不过,你所说的意思是把两个文件和成一个文件!运行它后,还是要生成两个文件!
    而我的意思是,只希望在硬盘上只有一个文件,而不是两个!因为我怕用户修改我的数据文件!请你多看看我的提问,我相信这五十分非你莫属!嘿嘿~^_^