Guys is it possible that I create a program that allows you to open a file, then if you click the button labelled "Properties", it will open the properties window for the file selected. This is so that you won't have to go to the file, right-click it, then select Properties.
Hope you get what I mean
Yes it is. I converted pieces of C# code I found on the net to this class. It does nothing except open the Files' Right-Click Properties Dialog window. As far as reading and writing to and from it I think M$ is keeping it a secret or we need to learn C/Assembly code to get at the meta-data. All I have been able to do is read them using Shell32 Namespace.
Option Strict On Option Explicit On Imports System.Runtime.InteropServices Public Class SHOW_PROPS Public Const SW_SHOW As Short = 5 Public Const SEE_MASK_INVOKEIDLIST As Short = 12 Private m_fileName As String Private m_handle As IntPtr Public Sub New(ByVal fileName As String, ByRef hndl As IntPtr) m_fileName = fileName m_handle = hndl Call ShowProperties() End Sub 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 <DllImport("Shell32", CharSet:=CharSet.Auto, SetLastError:=True)> _ Public Shared Function ShellExecuteEx(ByRef lpExecInfo As SHELLEXECUTEINFO) As Boolean End Function Private Sub ShowProperties() Dim sei As New SHELLEXECUTEINFO sei.cbSize = Marshal.SizeOf(sei) sei.lpVerb = "properties" sei.lpFile = m_fileName sei.nShow = SW_SHOW sei.fMask = SEE_MASK_INVOKEIDLIST sei.hwnd = m_handle Try ShellExecuteEx(sei) Catch ex As Exception MsgBox(ex.ToString & vbCrLf & ex.StackTrace.ToString) End Try End Sub End Class
Call it like this from your button click event;
Dim sp As New SHOW_PROPS(m_fileName, CType(Me.Handle, IntPtr))
This is written in VB2008 on XP Pro Sp3.