搜索
首页 电脑/网络 互联网

.lnk是什么文件 ?

语音回答

答案字数较多,建议语音阅读

00:00 00:00

全部回答

2005-09-17

    windows的很多lnk文件(也就是快捷方式)都是带有参数的,但是自己并不真正了解,不知道有谁知道?自己通过实践摸索出一些,希望能给大家带来帮助:/play—在打开连接后自动运行媒体文件"%1"—打开连接后自动出现文件选取框选择文件/Play"%L"—打开winamp后自动出现List选择框选择文件播放列表______________________________________如何通过lnk文件获取该文件的执行路径和程序functionLinkFileInfo(constln):boolean; :=false;getmem(buf,MAX_PATH);tryifSUCCEEDED(CoInitialize(nil))thenif(succeeded(cocreateinstance(clsid_shelllink,nil,clsctx_inproc_server,IID_IShellLinkA,psl)))thenbeginhr:=psl。
    QueryInterface(iPersistFile,ppf);ifsucceeded(hr)thenbeginlpw:=stringtowidechar(lnkfilename,buf,MAX_PATH);hr:=ppf。
  Load(lpw,STGM_READ);ifsucceeded(hr)thenbeginhr:=psl。  Resolve(0,SLR_NO_UI);ifsucceeded(hr)thenbeginifbSetthenbeginpsl。
  SetArguments(info。Arguments);psl。SetDescription(info。Description);psl。  SetHotkey(info。
  HotKey);psl。SetIconLocation(info。IconLocation,info。IconIndex);psl。SetIDList(info。ItemIDList);psl。
  SetPath(info。FileName);psl。  SetShowCmd(info。ShowState);psl。SetRelativePath(info。RelativePath,0);psl。
  SetWorkingDirectory(info。WorkDirectory);ifsucceeded(psl。Resolve(0,SLR_UPDATE))thenresult:=true;endelsebeginpsl。
    GetPath(info。FileName,MAX_PATH,wfd,SLGP_SHORTPATH);psl。GetIconLocation(info。IconLocation,MAX_PATH,info。
  IconIndex);psl。GetWorkingDirectory(info。  WorkDirectory,MAX_PATH);psl。GetDescription(info。
  Description,CCH_MAXNAME);psl。GetArguments(info。Arguments,MAX_PATH);psl。GetHotkey(info。  HotKey);psl。
  GetIDList(info。ItemIDList);psl。GetShowCmd(info。ShowState);result:=true;end;end;end;end;end;finallyfreemem(buf);end;end;//*******************调用*****************showmessage(\'FileName:\'+info。
    filename+#13+\'Description:\'+info。Description+#13+\'IconFilename:\'+info。IconLocation+\',\'+inttostr(info。
  IconIndex)+#13+\'WordDir:\'+info。  WorkDirectory+#13+\'Arguments:\'+info。Arguments+#13+\'ShorCuts:\'+shortcuttotext(s));info。
  WorkDirectory:=\'D:\\Borland\\Delphi5\\projects\';linkfileinfo(opendialog1。  filename,info,true);end;end;==============================================functionGetLinkFileName(sLin :string):boolean; :IPersistFile;hres, :TWin32FindData;pT :PWideChar;beginResult:=false;ifSUCCEEDED(CoInitialize(nil))thenbeginCoCreateInstance(CLSID_ShellLink,nil,CLSCTX_INPROC_SERVER,IID_IShellLinkA,psl);if(SUCCEEDED(hres))thenbeginhres:=psl。
    QueryInterface(IID_IPersistFile,ppf);if(SUCCEEDED(hres))thenbeginnLen:=MultiByteToWideChar(CP_ACP,0,PChar(sLinkFileName),-1,pwLinkFileName,0);GetMem(pwLinkFileName,nLen);ZeroMemory(pwLinkFileName,nLen);MultiByteToWideChar(CP_ACP,0,PChar(sLinkFileName),-1,pwLinkFileName,nLen);ppf。
    Load(pwLinkFileName,STGM_READ);GetMem(pTargetFile,MAX_PATH);ZeroMemory(pTargetFile,MAX_PATH);hres:=psl。
    GetPath(pTargetFile,MAX_PATH,pfd,SLGP_UNCPRIORITY);if(SUCCEEDED(hres))thenbeginsTargetFileName:=StrPas(pTargetFile);Result:=true;end;FreeMem(pTargetFile);FreeMem(pwLinkFileName);end;end;end;end;。
  

类似问题换一批

热点推荐

热度TOP

相关推荐
加载中...

热点搜索 换一换

电脑/网络
互联网
程序设计
电脑装机
操作系统/系统故障
硬件
笔记本电脑
百度
反病毒
软件
互联网
互联网
QQ
上网帮助
网站推荐
举报
举报原因(必选):
取消确定举报