比如打开了test.dll文件,如果让他显示在文本中?还有如何替换里面的字串。比如将里面的ff替换成00,谢谢了。
        Dim fileContents As Byte()
        fileContents = My.Computer.FileSystem.ReadAllBytes("e:\test.dll")

解决方案 »

  1.   

    Dim i as long
    Dim fileContents As Byte() 
    fileContents = My.Computer.FileSystem.ReadAllBytes("e:\test.dll")
    for i=0 to ubound(fileContents)
      if filecontents(i)=&HFF then filecontents(i)=0
    next
    字节显示成16进制 就用 hex 函数逐个转换了
    dim fileHexs() as string
    redim filehexs(ubound(fileContents))
    for i= 0 to ubound(fileContents)
      filehexs(i)=hex(fileContents(i))
      '假如每32个字节显示一行加下面这句
      if i mod 32 = 31 then filehexs(i)=filehexs(i)+vbcrlf
    next
    text1=join(filehexs," ")
      

  2.   

    for i= 0 to ubound(fileContents)
      if i mod 32 = 31 then filehexs(i)=filehexs(i)+vbcrlf
      filecontents(i)=val("&h"+replace(filehexs(i),vbcrlf,""))
    next
      

  3.   

    filehexs=split(text1," ")
    redim filecontents(ubound(filehexs))
    for i= 0 to ubound(filehexs)
      if i mod 32 = 31 then filehexs(i)=filehexs(i)+vbcrlf
      filecontents(i)=val("&h"+replace(filehexs(i),vbcrlf,""))
    next
      

  4.   

    最后的回复中
    if i mod 32 = 31 then filehexs(i)=filehexs(i)+vbcrlf
    多余了