2013年12月13日
摘要: 在项目中添加一个Application Manifest File,名字默认为app.manifest,内容中应该有一行:改成如下:这样再运行编译出来的exe就会弹出需要管理员权限的对话框了,允许之后整个exe就运行在管理员权限下了。P.S. VS中按F5运行的话会继承VS的权限,不会弹出要求管理员权限的对话框的。 阅读全文
posted @ 2013-12-13 15:48 BoneKing 阅读(559) 评论(0) 推荐(0) 编辑
摘要: public class Encrypt{ internal string ToEncrypt(string encryptKey, string str) { try { byte[] P_byte_key = //将密钥字符串转换为字节序列 Encoding.Unicode.GetBytes(encryptKey); byte[] P_byte_data = //将字符串转换为字节序列 Encoding.Unicode.GetBytes(s... 阅读全文
posted @ 2013-12-13 10:17 BoneKing 阅读(285) 评论(0) 推荐(0) 编辑
摘要: //获取当前进程的完整路径,包含文件名(进程名)。string str = this.GetType().Assembly.Location;result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)//获取新的 Process 组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名)。string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)// 阅读全文
posted @ 2013-12-13 10:10 BoneKing 阅读(229) 评论(0) 推荐(0) 编辑