SHObjectProperties (shell32)
Last changed: -5.28.133.135

.
Summary
(from MSDN) Invokes the Properties context menu command on a Shell object.

C# Signature:

[DllImport("shell32.dll", SetLastError=true)]
static extern bool SHObjectProperties(uint32 hwnd, uint32 shopObjectType, [MarshalAs(UnmanagedType.LPWStr)] string pszObjectName, [MarshalAs(UnmanagedType.LPWStr)] string pszPropertyPage);

(not 100% certain this is correct, need to test)

VB Signature:

Declare Function SHObjectProperties Lib "shell32.dll" _
    (ByVal hwnd As UInt32, ByVal shopObjectType As UInt32, _
    <MarshalAs(UnmanagedType.LPWStr)> ByVal pszObjectName As String, _
    <MarshalAs(UnmanagedType.LPWStr)> ByVal pszPropertyPage As String) As Boolean

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

Took me forever (okay, less than an hour) to figure out that this function failed with Integers or Longs and it wanted UInt32 for hwnd and shopObjectType.

Tips & Tricks:

Please add some!

Sample Code:

VB

Imports System.Runtime.InteropServices

Module Module1

    Sub Main()
    ShowProp("C:\boot.ini")
    'needed to keep the properties window open (window is bound to current application handle)
    Console.ReadKey()
    End Sub

    Public Enum GetProperties
    SHOP_PRINTERNAME = &H1  '// lpObject points to a printer friendly name
    SHOP_FILEPATH = &H2  '// lpObject points to a fully qualified path+file name
    SHOP_VOLUMEGUID = &H4  '// lpObject points to a Volume GUID
    End Enum

    Private Declare Function SHObjectProperties Lib "shell32.dll" _
    (ByVal hwnd As UInt32, ByVal shopObjectType As UInt32, _
    <MarshalAs(UnmanagedType.LPWStr)> ByVal pszObjectName As String, _
    <MarshalAs(UnmanagedType.LPWStr)> ByVal pszPropertyPage As String) As Boolean

    Public Function ShowProp(ByVal filename As String, Optional ByVal page As String = "") As Boolean
    If page = String.Empty Then
        page = 0
    Else
        page = page
    End If
    ShowProp = SHObjectProperties(0, GetProperties.SHOP_FILEPATH, filename, String.Empty)
    End Function

End Module

Documentation