【问题标题】:Visual basic in program information storage程序信息存储中的Visual Basic
【发布时间】:2011-12-02 21:02:19
【问题描述】:

我正在制作一个需要将信息存储在 exe 本身中的安装程序。

我无法使用 my.settings,因为它存储在应用程序之外,如果更改它并将 exe 移动到另一台计算机,它将重置为默认值。

而且我无法使用资源,因为在构建应用程序后我无法添加/编辑资源。

即使应用程序被移动到另一个位置,我有什么方法可以存储和更改信息吗?

感谢您的帮助,

【问题讨论】:

    标签: .net vb.net deployment resources settings


    【解决方案1】:

    我解决了。

    此代码允许我在 exe 文件的末尾添加信息而不会损坏它。

     Dim encoding As New System.Text.ASCIIEncoding()
            Dim pid As Byte() = encoding.GetBytes(vbnewline & "Text to add")
            My.Computer.FileSystem.WriteAllBytes("file.exe", pid, True)
    

    然后只需读取程序中读取行代码的最后一行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-28
      • 1970-01-01
      相关资源
      最近更新 更多