怎样在桌面上创建Internet快捷方式?
解决方案 »
- 怎么把子from在主from的panel里显示啊
- delphi调用C#开发的用户控件
- 远程连接PostgreSQL数据库错误!请指教!
- 我想学com组件开发。请高手们指点思路!!!
- 为何出现invalid column name'c93'错误,有分
- 一个很简单的,请看一下,好吗?用QUERY实行INSERT UPDATE DELETE 竟然实现不了
- 怎么求汉字的ASCⅡ码?
- 各位高手,这个查询语句怎么写,我没遇到过。帮我想想,谢谢了!
- 怎样屏蔽掉DBGrid向下方向键的自动Append功能?
- 使用sql自身的事务管理能象用Tdatabase控件一样可以先传递一个启动事务命令吗?
- 判断*.exe 程序是否运行?
- 我在使用ACReport报表时.退出时总有错误为什么....
CCH_MAXNAME=255;
LNK_RUN_MIN=7;
LNK_RUN_MAX=3;
LNK_RUN_NORMAL=1;
type
LINK_FILE_INFO=record
FileName:array[0..MAX_PATH] of char;
WorkDirectory:array[0..MAX_PATH] of char;
IconLocation:array[0..MAX_PATH] of char;
IconIndex:integer;
Arguments:array[0..MAX_PATH] of char;
Description:array[0..CCH_MAXNAME] of char;
ItemIDList:PItemIDList;
RelativePath:array[0..255] of char;
ShowState:integer;
HotKey:word;
end;function CreateLinkFile(const info:LINK_FILE_INFO;const DestFileName:string=''):boolean;
var
anobj:IUnknown;
shlink:IShellLink;
pFile:IPersistFile;
wFileName:widestring;
begin
wFileName:=destfilename;
anobj:=CreateComObject(CLSID_SHELLLINK);
shlink:=anobj as IShellLink;
pFile:=anobj as IPersistFile;
shlink.SetPath(info.FileName);
shlink.SetWorkingDirectory(info.WorkDirectory);
shlink.SetDescription(info.Description);
shlink.SetArguments(info.Arguments);
shlink.SetIconLocation(info.IconLocation,info.IconIndex);
shlink.SetHotkey(info.HotKey);
shlink.SetShowCmd(info.ShowState);
shlink.SetRelativePath(info.RelativePath,0);
if DestFileName='' then
wFileName:=ChangeFileExt(info.FileName,'lnk');
result:=succeeded(pFile.Save(pwchar(wFileName),false));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
rLnk : LINK_FILE_INFO;
pidl:pItemIDList;
pDesktop : string;
begin
rLnk.FileName := 'C:\Program Files\Internet Explorer\IEXPLORE.EXE';
rLnk.WorkDirectory := 'C:\Program Files\Internet Explorer\';
rLnk.IconIndex := 0; //取桌面路径
SetLength(pDesktop, 255);
SHGetSpecialFolderLocation(Self.Handle, CSIDL_DESKTOP, pidl);
SHGetPathFromIDList(pidl, PChar(pDesktop));
SetLength(pDesktop, StrLen(PChar(pDesktop))); CreateLinkFile(rLnk, pDesktop + '\' + 'I.lnk');
end;