创建桌面快捷方式
2015-07-18 15:50
246 查看
unit UShorCut; interface uses Windows, Classes, SysUtils,Dialogs, ShlObj, ComObj, ActiveX, Registry; procedure CreateUlr(ExeName,Description,FileName:string); implementation procedure CreateUlr(ExeName,Description,FileName:string); var ShLink: IShellLink; PFile: IPersistFile; //FileName: string; WFileName: WideString; Reg: TRegIniFile; AnObj: IUnknown; begin AnObj := CreateComObject(CLSID_ShellLink); //快捷方式的初始化 ShLink := AnObj as IShellLink; PFile := AnObj as IPersistFile; //FileName := ParamStr(0); ShLink.SetPath(PChar(FileName)); ShLink.SetWorkingDirectory(PChar(ExtractFilePath(FileName))); ShLink.SetDescription(PChar(Description));//('软件作者:***'+#13#10+' 公司:***'+#13#10+' 版本:V1.0.0.0'); Reg := TRegIniFile.Create('Software\MicroSoft\Windows\CurrentVersion\Explorer'); WFileName := Reg.ReadString('Shell Folders', 'Desktop', '') + '\' + ExeName + '.lnk'; Reg.Free; PFile.Save(PWChar(WFileName), False); Reg := TRegIniFile.Create('Software\MicroSoft\Windows\CurrentVersion\Explorer'); WFileName := Reg.ReadString('Shell Folders', 'Start Menu', '') + '\' + ExeName + '.lnk'; Reg.Free; PFile.Save(PWChar(WFileName), False); end; end.
相关文章推荐
- leetcode 77:Combinations
- [BZOJ2818] Gcd
- 简单算法(java实现)
- POJ3061 Subsequence(二进制前缀和法律+仿真足)
- NPOI导入导出Excel (2)
- 论坛:Html代码生成器>>FCKeditor的使用
- 【bzoj2594】[Wc2006]水管局长数据加强版
- new 与malloc的区别
- Project Euler 46 solution optimized using SSE2
- NanoMsg-0.5beta编译和测试
- JS frame 跨域 传值
- 深入理解Linux内核-内核同步
- 找词”游戏是在美国流行的一种游戏,它要求游戏者从一张填满字母的正方形表中,找出包含在一个给定集合中的所有词。这些词可以竖着读(向上或向下)、横着读(从左或从右),或者沿45度对角线斜着读。
- 杭电acm1006的问题,以秒为单位进行解答怎么改才能AC
- codevs1036
- Java中注释/**@hide*/的初步认识
- hdu2612 两遍BFS
- Symmetry(对称轴存在问题)
- STM32学习笔记——高级定时器TIM1更新中断配置
- poj 1273 EK最大流入门题