Base: move Files
This commit is contained in:
36
Base/WindowsEx.vb
Normal file
36
Base/WindowsEx.vb
Normal file
@@ -0,0 +1,36 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Base.NativeMethods
|
||||
|
||||
Public Class WindowsEx
|
||||
Private ReadOnly _LogConfig As LogConfig
|
||||
Private ReadOnly _Logger As Logger
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
End Sub
|
||||
|
||||
Public Function OpenFileProperties(FilePath As String) As Boolean
|
||||
Try
|
||||
Dim oShellExecuteInfo As New ShellExecuteInfo()
|
||||
oShellExecuteInfo.cbSize = Marshal.SizeOf(oShellExecuteInfo)
|
||||
oShellExecuteInfo.lpVerb = "properties"
|
||||
oShellExecuteInfo.lpFile = FilePath
|
||||
oShellExecuteInfo.nShow = SW_SHOW
|
||||
oShellExecuteInfo.fMask = SEE_MASK_INVOKEIDLIST
|
||||
|
||||
If Not ShellExecuteEx(oShellExecuteInfo) Then
|
||||
Dim oWin32Error = Marshal.GetLastWin32Error()
|
||||
Dim oException As New Win32Exception(oWin32Error)
|
||||
Throw oException
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user