How to programmatically get an exe file description?

How to programmatically get an exe file description? For instance, for "C:\Program Files (x86)\Internet Explorer\iexplore.exe", and for it, you would get "Internet Explorer" if you right click on the file, and look in the Properties>General for the Description label...

But how to do it programmatically, from your own program (VB6), having the exe file path? I suppose, an API function should do the job, but I can't find which one and an example for it...
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
I don't believe that Microsoft provides a way to retrieve that information. The SHGetFileInfo API can return a "description" but that "description" is "Application" for a VB6 exe.

If you can describe why you need the description then maybe there's another way to do it.
Michael FowlerSolutions ConsultantCommented:
I think what you are after is the FileInfo class eg

Dim information As System.IO.FileInfo
information = My.Computer.FileSystem.GetFileInfo("C:\MyLogFile.log")

Open in new window
Martin LissOlder than dirtCommented:
That's .Net code and the Asker is talking about VB6.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Michael FowlerSolutions ConsultantCommented:
Oops sorry. Martin is right

Here is a better example
Martin LissOlder than dirtCommented:
Here's code from the API Guide that uses that API. Rather than specifically giving you the Description, it displays the Properties window that you can get when you right click on a file name. That window of course includes the Description. You'll need to change line 51 to refer the the file you are interested in.

Option Explicit

    cbSize As Long
    fMask As Long
    hwnd As Long
    lpVerb As String
    lpFile As String
    lpParameters As String
    lpDirectory As String
    nShow As Long
    hInstApp As Long
    lpIDList As Long
    lpClass As String
    hkeyClass As Long
    dwHotKey As Long
    hIcon As Long
    hProcess As Long
End Type
Private Declare Function ShellExecuteEx Lib "shell32.dll" (SEI As SHELLEXECUTEINFO) As Long
Sub ShowProps(FileName As String, OwnerhWnd As Long)
    Dim r As Long
    With SEI
        'Set the structure's size
        .cbSize = Len(SEI)
        'Seet the mask
        'Set the owner window
        .hwnd = OwnerhWnd
        'Show the properties
        .lpVerb = "properties"
        'Set the filename
        .lpFile = FileName
        .lpParameters = vbNullChar
        .lpDirectory = vbNullChar
        .nShow = 0
        .hInstApp = 0
        .lpIDList = 0
    End With
    r = ShellExecuteEx(SEI)
End Sub
Private Sub Form_Load()
    'KPD-Team 1999
    ShowProps "C:\Program Files\Microsoft Visual Studio\VB98\project1.exe", Me.hwnd
End Sub

Open in new window

npaunAuthor Commented:
Thanks for the comments.
However, I need the file description in a nice usable form, as a string, without bringing an external window...
Nevertheless, I've found a way to do it:
with one correction, it is with on index 34, not 36 as mentioned there
Anyway, thank you for the effort...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
npaunAuthor Commented:
PS: The approach I've found seems not to work on XP though...
However, this one seems to work on XP:
npaunAuthor Commented:
I've found an exact solution from other sources...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.