Y
yxq
Hello,
The code below can popup the property dialog of a file, it works well on XP,
Vista 32bit, but it will not work on Vista 64bit, how to correct it? i have
tried to change integer to intptr, but not work yet, thank you.
//////////////////////////////////////////////////////
<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>
Public Class SHELLEXECUTEINFO
Public cbSize As Integer
Public fMask As Integer
Public hwnd As Integer
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr),
Microsoft.VisualBasic.VBFixedString(255)> Public lpVerb As String = ""
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr),
Microsoft.VisualBasic.VBFixedString(255)> Public lpFile As String = ""
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr),
Microsoft.VisualBasic.VBFixedString(255)> Public lpParameters As String = ""
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr),
Microsoft.VisualBasic.VBFixedString(255)> Public lpDirectory As String = ""
Public nShow As Integer
Public hInstApp As Integer
Public lpIDList As Integer
Public lpClass As String
Public hkeyClass As Integer
Public dwHotKey As Integer
Public hIcon As Integer
Public hProcess As Integer
Private Const SW_SHOW As Integer = 5
Private Const SEE_MASK_INVOKEIDLIST As Integer = &HC
Private Declare Auto Function ShellExecuteEX Lib "shell32.dll" Alias
"ShellExecuteEx" (ByVal SEI As SHELLEXECUTEINFO) As Integer
Public Shared Sub ShowPropertiesDialog(ByVal Path As String)
If System.IO.File.Exists(Path) Or System.IO.Directory.Exists(Path)
Then
Dim shInfo As New SHELLEXECUTEINFO
shInfo.cbSize =
System.Runtime.InteropServices.Marshal.SizeOf(GetType(SHELLEXECUTEINFO))
shInfo.lpFile = Path
shInfo.nShow = SW_SHOW
shInfo.fMask = SEE_MASK_INVOKEIDLIST
shInfo.lpVerb = "properties"
ShellExecuteEX(shInfo)
End If
End Sub
End Class
The code below can popup the property dialog of a file, it works well on XP,
Vista 32bit, but it will not work on Vista 64bit, how to correct it? i have
tried to change integer to intptr, but not work yet, thank you.
//////////////////////////////////////////////////////
<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>
Public Class SHELLEXECUTEINFO
Public cbSize As Integer
Public fMask As Integer
Public hwnd As Integer
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr),
Microsoft.VisualBasic.VBFixedString(255)> Public lpVerb As String = ""
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr),
Microsoft.VisualBasic.VBFixedString(255)> Public lpFile As String = ""
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr),
Microsoft.VisualBasic.VBFixedString(255)> Public lpParameters As String = ""
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr),
Microsoft.VisualBasic.VBFixedString(255)> Public lpDirectory As String = ""
Public nShow As Integer
Public hInstApp As Integer
Public lpIDList As Integer
Public lpClass As String
Public hkeyClass As Integer
Public dwHotKey As Integer
Public hIcon As Integer
Public hProcess As Integer
Private Const SW_SHOW As Integer = 5
Private Const SEE_MASK_INVOKEIDLIST As Integer = &HC
Private Declare Auto Function ShellExecuteEX Lib "shell32.dll" Alias
"ShellExecuteEx" (ByVal SEI As SHELLEXECUTEINFO) As Integer
Public Shared Sub ShowPropertiesDialog(ByVal Path As String)
If System.IO.File.Exists(Path) Or System.IO.Directory.Exists(Path)
Then
Dim shInfo As New SHELLEXECUTEINFO
shInfo.cbSize =
System.Runtime.InteropServices.Marshal.SizeOf(GetType(SHELLEXECUTEINFO))
shInfo.lpFile = Path
shInfo.nShow = SW_SHOW
shInfo.fMask = SEE_MASK_INVOKEIDLIST
shInfo.lpVerb = "properties"
ShellExecuteEX(shInfo)
End If
End Sub
End Class