将资源写入可执行文件 [英] Writing Resource to executable

查看:100
本文介绍了将资源写入可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在执行过程中将数据写入可执行文件?我的最终结果是更新可执行文件中的嵌入式资源.例如,在可执行文件中,我有一个资源字符串,其中列出了上次启动时间.关闭应用程序后,它将更新资源字符串.这可能吗?

Mike

Would it be possible to write data to an executable as it''s executing? My end result is to update the embedded resources inside the executable. For example, inside an executable, I''d have a resource string that lists the last startup time. After the application is closed, it would update the resource string. Is this possible?

Mike

推荐答案

是的,在Settings(项目属性> Settings)中创建一个字符串属性.

然后您可以像这样访问它

Yes, Create a string property in Settings(Project Properties > Settings).

And then you can access it like this

string tvalue = Properties.Settings.Default.YourPropertyName;



然后可以将其保存在FormClosing事件中,就像这样




and you can save it, in FormClosing event...like this


Properties.Settings.Default.YourPropertyName = "Some other text";
Properties.Settings.Default.Save();


这篇关于将资源写入可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆