• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 600
  • Last Modified:

Delphi 2010: Get Description for .lnk file for Disk Defragmenter

Hi,
In Windows 7 I have a file in my Start Menu with the name dfrgui.lnk.
In the Start Menu this one is displayed as 'Disk Defragmenter', but as I said the file is named dfrgui.lnk
That .lnk file points to %windir%\system32\dfrgui.exe
The description for that file is 'Microsoft (R) Disk Defragmenter', so that is a different value as well.
I'm looking for a way to get the text 'Disk Defragmenter' from the dfrgui.lnk file, so I can display it in 'my own Start Menu'.
Thanks.
0
tacojoosterkamp
Asked:
tacojoosterkamp
1 Solution
 
thiagoblimeiraCommented:
Simple, this procedure will recover 'Disk Defragmenter' from the dfrgui.lnk file

uses ShellAPI

procedure TForm1.GetFileDisplayName(strPath: string; var DisplayName: string);
var
  FileInfo: SHFILEINFO;
begin
   //Get The DisplayName
   SHGetFileInfo(PChar(strPath), 0, FileInfo, SizeOf(FileInfo), SHGFI_DISPLAYNAME);
   DisplayName := FileInfo.szDisplayName;
end;
0
 
tacojoosterkampAuthor Commented:
Thanks - works like charm!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now