|
-
Mar 15th, 2011, 09:52 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Shell - Show Properties
I know a couple of these threads exist on the internet, but none describe what I am having...
vb Code:
Public Structure SHELLEXECUTEINFO
Public cbSize As Integer
Public fMask As Integer
Public hwnd As IntPtr
<MarshalAs(UnmanagedType.LPTStr)> Public lpVerb As String
<MarshalAs(UnmanagedType.LPTStr)> Public lpFile As String
<MarshalAs(UnmanagedType.LPTStr)> Public lpParameters As String
<MarshalAs(UnmanagedType.LPTStr)> Public lpDirectory As String
Dim nShow As Integer
Dim hInstApp As IntPtr
Dim lpIDList As IntPtr
<MarshalAs(UnmanagedType.LPTStr)> Public lpClass As String
Public hkeyClass As IntPtr
Public dwHotKey As Integer
Public hIcon As IntPtr
Public hProcess As IntPtr
End Structure
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 Integer = 5
Private Declare Function ShellExecuteEx Lib "shell32.dll" Alias "ShellExecuteExA" (ByRef lpExecInfo As SHELLEXECUTEINFO) As Boolean
Public Function ShowProps(ByVal FileName As String, ByVal OwnerhWnd As IntPtr) As Boolean
Dim sei As New SHELLEXECUTEINFO
sei.cbSize = Marshal.SizeOf(sei)
sei.fMask = SEE_MASK_INVOKEIDLIST
sei.hwnd = OwnerhWnd
sei.lpVerb = "properties"
sei.lpFile = FileName
sei.lpParameters = vbNullChar
sei.lpDirectory = vbNullChar
sei.nShow = SW_SHOW
sei.hInstApp = 0
sei.lpIDList = 0
Return ShellExecuteEx(sei)
End Function
(import Marshal btw)
When I first ran the code, it worked. But after some days (now) it suddenly stopped working, and only displays an error with, for example:
"Windows cannon find 'C'. Make sure you type the name correctly, and then try again.
This, while I send the request for the file of "C:\test.txt". It only seems to read the first character. What is going on here? 
(Running on Window 7)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|