Displaying the File Properties Dialog

Author: Lothar A. Haensler

Displaying the File Properties Dialog

This code shows how to display the file properties dialog through VB5/6 Code.

screen shot

Paste the following code into a module in your project:

option Explicit
private Const SW_SHOW = 5
    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
    ' optional fields
    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" _
    (byref s as SHELLEXECUTEINFO) as Long

public Sub DisplayFileProperties(byval sFullFileAndPathName as string)
    With shInfo
        .cbSize = LenB(shInfo)
        .lpFile = sFullFileAndPathName
        .nShow = SW_SHOW
        .lpVerb = "properties"
    End With
    ShellExecuteEx shInfo
End Sub

Now simply call the DisplayFileProperties routine with the full file and path name of the required file to display the properties.

Download Zipped Project File (5k)


  • Extraordinaire

    Posted by jperciot on 07/15/2005 02:16am

    Ca marche mC*me en Visual C++ 6.0. Merci pour ce code, il m'a bien aidC).
    Voici le source C++ C_ intC)grer...
    (st = Chemin complet de votre fichier "c:\test.txt" par exemple)
    		ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    		ShExecInfo.lpVerb = "properties";
    		ShExecInfo.lpFile = st;
    		ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST;
    		ShExecInfo.hwnd = NULL;
    		ShExecInfo.lpParameters = NULL;
    		ShExecInfo.lpDirectory = NULL;
    		ShExecInfo.nShow = SW_SHOW;
    		ShExecInfo.hInstApp = NULL;
    		ShellExecuteEx (&ShExecInfo);

    • Extra bis

      Posted by jperciot on 07/15/2005 04:37am

      ShExecInfo.lpVerb = "Properties"; sinon C'a plante.

  • reading width and height properties of digital media files?

    Posted by Legacy on 01/24/2003 12:00am

    Originally posted by: Giles

    is there any way of reading the width and height properties of digital media files with VB?



  • Registry

    Posted by Legacy on 10/01/2002 12:00am

    Originally posted by: NetCreativeMind

    Proxy, Bandwidth, Registry, Database, C,
    VB, Website, Hardware, Network,

  • How to get just the revision number

    Posted by Legacy on 05/24/2002 12:00am

    Originally posted by: Richard Houde

    I want to ba able to just retrieve the revision number of a file. How would I go about getting that?

  • How to read file properties programmatically?

    Posted by Legacy on 04/02/2002 12:00am

    Originally posted by: Robert

    Great work! Do you know of a way to read this information programmatically?

  • ShellExecuteEX

    Posted by Legacy on 01/09/2002 12:00am

    How can I detect whether the OK button or the Cancel button of the properties dialog has been clicked. The processID seems to be always equal to zero.

  • Position

    Posted by Legacy on 12/08/2000 12:00am

    Originally posted by: Ingo

    How can I positioniering the file properity dialog??

  • But for multiple files ??

    Posted by Legacy on 08/02/2000 12:00am

    Originally posted by: David Burg

    Ok, this is good, but what about a single dialog box for several files like in the windows explorer ? Because the lpName member of the structure is only designed for one file...

  • Current active Filename

    Posted by Legacy on 05/10/2000 12:00am

    Originally posted by: Priya

    You have given the code for any file name.How do I do it for the current active Filename in my application.
    for eg. if the user selects file->properties in my appliaction, it should give the properties for the current active filename.

    please help
    Thank you

  • Displaying the File Properties Dialog

    Posted by Legacy on 10/19/1999 12:00am

    Originally posted by: Edwin Lima


    It'sjust right what I was looking for

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Moving from an on-premises environment to Office 365 does not remove the need to plan for disruptions or reduce the business risk requirements for protecting email services. If anything, some risks increase with a move to the cloud. Read how to ease the transition every business faces if considering or already migrating to cloud email. This white paper discusses: Setting expectations when migrating to Office 365 Understanding the implications of relying solely on Exchange Online security Necessary archiving …

  • Lenovo recommends Windows 8 Pro. "I dropped my laptop getting out of the taxi." This probably sounds familiar to most IT professionals. If your employees are traveling, you know their devices are in for a rough go. Whether it's a trip to the conference room or a convention out of town, any time equipment leaves a user's desk it is at risk of being put into harm's way. Stay connected at all times, whether at the office or on the go, with agile, durable, and flexible devices like the Lenovo® …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date