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

Posted on 2010-01-01
Last Modified: 2013-11-23
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'.
Question by:tacojoosterkamp
    LVL 8

    Accepted Solution

    Simple, this procedure will recover 'Disk Defragmenter' from the dfrgui.lnk file

    uses ShellAPI

    procedure TForm1.GetFileDisplayName(strPath: string; var DisplayName: string);
      FileInfo: SHFILEINFO;
       //Get The DisplayName
       SHGetFileInfo(PChar(strPath), 0, FileInfo, SizeOf(FileInfo), SHGFI_DISPLAYNAME);
       DisplayName := FileInfo.szDisplayName;

    Author Comment

    Thanks - works like charm!

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now