Programming » Visual Basic 6 » Visual Basic 6 Code » Common Dialogs » ");?>
Display the standard file properties box for a file.
Option Explicit

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    'Optional parameter
    lpClass       As String  'Optional parameter
    hkeyClass     As Long    'Optional parameter
    dwHotKey      As Long    'Optional parameter
    hIcon         As Long    'Optional parameter
    hProcess      As Long    'Optional parameter
End Type

Public Const SEE_MASK_INVOKEIDLIST = &HC
Public Const SEE_MASK_NOCLOSEPROCESS = &H40
Public Const SEE_MASK_FLAG_NO_UI = &H400

Declare Function ShellExecuteEX _
        Lib "shell32.dll" Alias "ShellExecuteEx" _
        (SEI As SHELLEXECUTEINFO) As Long

Public Sub ShowProperties(filename As String, OwnerhWnd As Long)

    'open a file properties property page for
    'specified file if return value

    Dim SEI As SHELLEXECUTEINFO
    Dim r As Long

    'Fill in the SHELLEXECUTEINFO structure
    With SEI
        .cbSize = Len(SEI)
        .fMask = SEE_MASK_NOCLOSEPROCESS Or _
                SEE_MASK_INVOKEIDLIST Or _
                SEE_MASK_FLAG_NO_UI
        .hwnd = OwnerhWnd
        .lpVerb = "properties"
        .lpFile = filename
        .lpParameters = vbNullChar
        .lpDirectory = vbNullChar
        .nShow = 0
        .hInstApp = 0
        .lpIDList = 0
    End With

    'call the API to display the property sheet
    r = ShellExecuteEX(SEI)

End Sub