Showing posts with label 【VISUAL VB NET】File Properties. Show all posts
Showing posts with label 【VISUAL VB NET】File Properties. Show all posts

Sunday, 11 April 2021

【VISUAL VB NET】File Properties

 Imports System

Imports System.Collections.Generic

Imports System.ComponentModel

Imports System.Data

Imports System.Drawing

Imports System.Linq

Imports System.Text

Imports System.Threading.Tasks

Imports System.Windows.Forms

' make sure that using System.Diagnostics; is included

Imports System.Diagnostics

' make sure that using System.Security.Principal; is included

Imports System.Security.Principal


' make sure that using System.Runtime.InteropServices; is included

Imports System.Runtime.InteropServices

' make sure that using System.IO; is included

Imports System.IO

Public Class Form1

    Inherits Form

    <DllImport("shell32.dll", CharSet:=CharSet.Auto)>

    Private Shared Function ShellExecuteEx(ByRef lpExecInfo As SHELLEXECUTEINFO) As Boolean

    End Function


    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)>

    Public Structure SHELLEXECUTEINFO

        Public cbSize As Integer

        Public fMask As UInteger

        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

        Public nShow As Integer

        Public hInstApp As IntPtr

        Public lpIDList As IntPtr

        <MarshalAs(UnmanagedType.LPTStr)>

        Public lpClass As String

        Public hkeyClass As IntPtr

        Public dwHotKey As UInteger

        Public hIcon As IntPtr

        Public hProcess As IntPtr

    End Structure


    Private Const SW_SHOW As Integer = 5

    Private Const SEE_MASK_INVOKEIDLIST As UInteger = 12


    Public Sub New()

        MyBase.New()

        InitializeComponent()

    End Sub


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


    End Sub

    Public Shared Function ShowFileProperties(Filename As String) As Boolean

        Dim info As New SHELLEXECUTEINFO()

        info.cbSize = Marshal.SizeOf(info)

        info.lpVerb = "properties"

        info.lpFile = Filename

        info.nShow = SW_SHOW

        info.fMask = SEE_MASK_INVOKEIDLIST

        Return ShellExecuteEx(info)

    End Function

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then

            ShowFileProperties(Path.GetFullPath(OpenFileDialog1.FileName))

        End If

    End Sub

End Class


BREAKING: North Carolina automotive group acquires 7 Upstate dealerships

Breaking news from GSA Business Report Click here to view this message in a browser window. ...