Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to load and read a shortcut to see where it points to Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
03-Oct-02
Category
Shell API
Language
Delphi 2.x
Views
133
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			v 

How to load and read a shortcut to see where it points to

Answer:
1   
2   procedure GetShellLinkInfo(const LinkFile: WideString; var SLI: TShellLinkInfo);
3   {Retrieves information on an existing shell link}
4   var
5     SL: IShellLink;
6     PF: IPersistFile;
7     FindData: TWin32FindData;
8     AStr: array[0..MAX_PATH] of char;
9   begin
10    OleCheck(CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER, IShellLink,
11      SL));
12    {The IShellLink implementer must also support the IPersistFile interface. Get an 
13  interface pointer to it}
14    PF := SL as IPersistFile;
15    { Load file into IPersistFile object }
16    OleCheck(PF.Load(PWideChar(LinkFile), STGM_READ));
17    {Resolve the link by calling the Resolve interface function}
18    OleCheck(SL.Resolve(0, SLR_ANY_MATCH or SLR_NO_UI));
19    {Get all the info}
20    with SLI do
21    begin
22      OleCheck(SL.GetPath(AStr, MAX_PATH, FindData, SLGP_SHORTPATH));
23      PathName := AStr;
24      OleCheck(SL.GetArguments(AStr, MAX_PATH));
25      Arguments := AStr;
26      OleCheck(SL.GetDescription(AStr, MAX_PATH));
27      Description := AStr;
28      OleCheck(SL.GetWorkingDirectory(AStr, MAX_PATH));
29      WorkingDirectory := AStr;
30      OleCheck(SL.GetIconLocation(AStr, MAX_PATH, IconIndex));
31      IconLocation := AStr;
32      OleCheck(SL.GetShowCmd(ShowCmd));
33      OleCheck(SL.GetHotKey(HotKey));
34    end;
35  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC