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
private Const SEE_MASK_INVOKEIDLIST = &HC
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
    ' 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)
    Dim shInfo as SHELLEXECUTEINFO
    
    With shInfo
        .cbSize = LenB(shInfo)
        .lpFile = sFullFileAndPathName
        .nShow = SW_SHOW
        .fMask = SEE_MASK_INVOKEIDLIST
        .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)



Comments

  • 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)
    
    SHELLEXECUTEINFO ShExecInfo;
    		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.

      Reply
    Reply
  • 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?

    .mov
    .avi
    .mpg

    ??

    Reply
  • Registry

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

    Originally posted by: NetCreativeMind

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

    Reply
  • 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?
    
    Thanks.

    Reply
  • 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?

    Reply
  • 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.

    Reply
  • Position

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

    Originally posted by: Ingo

    How can I positioniering the file properity dialog??

    Reply
  • 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...

    Reply
  • 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
    Priya

    Reply
  • Displaying the File Properties Dialog

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

    Originally posted by: Edwin Lima

    Excellent:

    It'sjust right what I was looking for

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

Top White Papers and Webcasts

  • Wednesday, September 24, 2014 8:00 AM - 9:00 AM PDT According to a recent Forrester Research report, many companies are choosing low-code platforms over traditional programming platforms, due to the speed with which low-code apps can be assembled and tested. With customer-facing applications on the rise, traditional programming platforms simply can't keep up with the "short schedules and rapid change cycles" required to develop these applications. Check out this upcoming webinar and join Clay Richardson from …

  • The explosion in mobile devices and applications has generated a great deal of interest in APIs. Today's businesses are under increased pressure to make it easy to build apps, supply tools to help developers work more quickly, and deploy operational analytics so they can track users, developers, application performance, and more. Apigee Edge provides comprehensive API delivery tools and both operational and business-level analytics in an integrated platform. It is available as on-premise software or through …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds