Imports System.Runtime.InteropServices Imports DigitalData.Modules.Logging Public Class ClassWindowsAPI Private Const SEE_MASK_INVOKEIDLIST = &HC Private Const SEE_MASK_NOCLOSEPROCESS = &H40 Private Const SEE_MASK_FLAG_NO_UI = &H400 Private Const SW_SHOW As Short = 5 Private _LogConfig As LogConfig Private _Logger As Logger Public Shared Function ShellExecuteEx(ByRef lpExecInfo As ShellExecuteInfo) As Boolean End Function Public Structure ShellExecuteInfo Public cbSize As Integer Public fMask As Integer Public hwnd As IntPtr Public lpVerb As String Public lpFile As String Public lpParameters As String Public lpDirectory As String Dim nShow As Integer Dim hInstApp As IntPtr Dim lpIDList As IntPtr Public lpClass As String Public hkeyClass As IntPtr Public dwHotKey As Integer Public hIcon As IntPtr Public hProcess As IntPtr End Structure Public Sub New(LogConfig As LogConfig) _LogConfig = LogConfig _Logger = LogConfig.GetLogger() End Sub Public Sub ShowFileProperties(FilePath As String) If FilePath = String.Empty OrElse Not IO.File.Exists(FilePath) Then Logger.Warn("Could not show file properties. FilePath '{0}' is invalid or does not exist.", FilePath) Exit Sub End If Dim oInfo As New ShellExecuteInfo With { .cbSize = Marshal.SizeOf(oInfo), .lpVerb = "properties", .lpFile = FilePath, .nShow = SW_SHOW, .fMask = SEE_MASK_INVOKEIDLIST } If Not ShellExecuteEx(oInfo) Then Dim ex As New ComponentModel.Win32Exception(Marshal.GetLastWin32Error()) Logger.Warn("Could not show file properties. Reason: {0}", ex.Message) Logger.Error(ex) End If End Sub End Class