UAC窗体应用措施默认设置信息读写的题目
UAC 是 Vista 与 Win7 安详基本。
在打开UAC的环境下,窗体应用措施默认设置信息的读取与写入,在 Program Files 文件夹下将会激发一些错误。 研究了许多伴侣,多是通过晋升应用措施权限,要求用户以打点员身份行使软件的方法,来办理这个题目。 晋升权限往返避UAC的节制,这种办理方法,并欠稳当。 研究了几天,转了好大一圈,终于起源办理了这个题目,三更午夜,担忧办理的彻底,在此抛砖引玉,但愿美满办理题目。 ----------------------------------------------------------------------------------------- 代码 public 结构函数() tmp.ExeConfigFilename = ConfigerFile(); ShiQiangConfiger = ConfigurationManager.OpenMappedExeConfiguration(tmp, ConfigurationUserLevel.None); //-------------------------------------------------------------------// private string ConfigerFile() int targetIndex = Application.ExecutablePath.LastIndexOf(@""); if (targetIndex >= 0) rtnValue = System.IO.Path.Combine(Application.CommonAppDataPath, Application.ExecutablePath.Substring(targetIndex + 1) + ".Config"); if (!System.IO.File.Exists(rtnValue)) tmp.SaveAs(rtnValue); return rtnValue; private System.Configuration.Configuration myConfiguration; 下面用 myConfiguration 就可以举办凡是的设置文件操纵了。 原文:http://www.cnblogs.com/sasbya/archive/2010/05/05/1727632.html (编辑:湖南网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |