F
Faraz Azhar
Hello
I need to show the shell's file properties dialog box. I tried
converting old vb6 code into vb.net but it gives me error. Here's my
code:
Private Structure SHELLEXECUTEINFO
Dim cbSize As Long
Dim fMask As Long
Dim hwnd As Long
Dim lpVerb As String
Dim lpFile As String
Dim lpParameters As String
Dim lpDirectory As String
Dim nShow As Long
Dim hInstApp As Long
Dim lpIDList As Long
Dim lpClass As String
Dim hkeyClass As Long
Dim dwHotKey As Long
Dim hIcon As Long
Dim hProcess As Long
End Structure
Private Declare Function ShellExecuteEx Lib "shell32" Alias
"ShellExecuteExA" (ByVal SEI As SHELLEXECUTEINFO) As Long
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Const SEE_MASK_NOCLOSEPROCESS = &H40
Private Const SEE_MASK_FLAG_NO_UI = &H400
Public Sub ShowFileProperties(ByVal sFilename As String, ByVal
hWndOwner As Long)
Dim SEI As SHELLEXECUTEINFO
'Fill in the SHELLEXECUTEINFO structure
With SEI
.cbSize = Len(SEI)
.fMask = SEE_MASK_INVOKEIDLIST Or SEE_MASK_NOCLOSEPROCESS
Or SEE_MASK_FLAG_NO_UI
.lpVerb = "properties"
.lpFile = sFilename
End With
'call the API to display the property sheet
Call ShellExecuteEx(SEI)
End Sub
Now when I call the above sub like this from my main form:
ShowFileProperties(szFileName, Me.Handle)
It gives me the following error:
"Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."
No idea whats happening here. Need help.
I need to show the shell's file properties dialog box. I tried
converting old vb6 code into vb.net but it gives me error. Here's my
code:
Private Structure SHELLEXECUTEINFO
Dim cbSize As Long
Dim fMask As Long
Dim hwnd As Long
Dim lpVerb As String
Dim lpFile As String
Dim lpParameters As String
Dim lpDirectory As String
Dim nShow As Long
Dim hInstApp As Long
Dim lpIDList As Long
Dim lpClass As String
Dim hkeyClass As Long
Dim dwHotKey As Long
Dim hIcon As Long
Dim hProcess As Long
End Structure
Private Declare Function ShellExecuteEx Lib "shell32" Alias
"ShellExecuteExA" (ByVal SEI As SHELLEXECUTEINFO) As Long
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Const SEE_MASK_NOCLOSEPROCESS = &H40
Private Const SEE_MASK_FLAG_NO_UI = &H400
Public Sub ShowFileProperties(ByVal sFilename As String, ByVal
hWndOwner As Long)
Dim SEI As SHELLEXECUTEINFO
'Fill in the SHELLEXECUTEINFO structure
With SEI
.cbSize = Len(SEI)
.fMask = SEE_MASK_INVOKEIDLIST Or SEE_MASK_NOCLOSEPROCESS
Or SEE_MASK_FLAG_NO_UI
.lpVerb = "properties"
.lpFile = sFilename
End With
'call the API to display the property sheet
Call ShellExecuteEx(SEI)
End Sub
Now when I call the above sub like this from my main form:
ShowFileProperties(szFileName, Me.Handle)
It gives me the following error:
"Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."
No idea whats happening here. Need help.