简体   繁体   English

程序信息存储中的Visual Basic

[英]Visual basic in program information storage

I'm making an installer that needs to have information stored inside the exe itself. 我正在做一个需要在exe本身内部存储信息的安装程序。

I cannot use my.settings because it is stored outside the application and if it is changed and the exe is moved to another computer it will reset to default. 我无法使用my.settings,因为它存储在应用程序外部,并且如果将其更改并将exe移至另一台计算机,它将重置为默认值。

And I cannot use resources since I cannot add/edit resources after the application is build. 而且我无法使用资源,因为构建应用程序后无法添加/编辑资源。

Is there any way I can store and change info even if the application is moved to another location? 即使将应用程序移动到另一个位置,我还有什么方法可以存储和更改信息?

Thanks for any help, 谢谢你的帮助,

I solved it. 我解决了

This code allowed me to add information to the end of the exe file without corrupting it. 此代码使我可以将信息添加到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)

and then just read the last line with read line code within the program. 然后只需在程序中读取带有读取行代码的最后一行即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM