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...
npaunAsked:
Who is Participating?
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.
0
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


https://msdn.microsoft.com/en-us/library/system.io.fileinfo_members(v=vs.90).aspx
0
Martin LissOlder than dirtCommented:
That's .Net code and the Asker is talking about VB6.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Michael FowlerSolutions ConsultantCommented:
Oops sorry. Martin is right

Here is a better example

http://www.techrepublic.com/article/displaying-file-properties-from-within-vb6/
0
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

Const SEE_MASK_INVOKEIDLIST = &HC
Const SEE_MASK_NOCLOSEPROCESS = &H40
Const SEE_MASK_FLAG_NO_UI = &H400
Private Type SHELLEXECUTEINFO
    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 SEI As SHELLEXECUTEINFO
    Dim r As Long
    With SEI
        'Set the structure's size
        .cbSize = Len(SEI)
        'Seet the mask
        .fMask = SEE_MASK_NOCLOSEPROCESS Or _
         SEE_MASK_INVOKEIDLIST Or SEE_MASK_FLAG_NO_UI
        '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
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    ShowProps "C:\Program Files\Microsoft Visual Studio\VB98\project1.exe", Me.hwnd
End Sub

Open in new window

0
npaunAuthor Commented:
@All
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: http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_25635617.html
with one correction, it is with on index 34, not 36 as mentioned there
Anyway, thank you for the effort...
0

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: https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4976&lngWId=1
0
npaunAuthor Commented:
I've found an exact solution from other sources...
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.