当前位置:首页 > 编程学习 > VB.NET 用ShellExecuteEx 打开系统文件属性对话框 模块

VB.NET 用ShellExecuteEx 打开系统文件属性对话框 模块

编程学习2007-06-0949340
'
' VB.NET 调用系统文件属性对话框模块
'
' by: Apull
' QQ:374237545
' http://www.apull.net
' 2007-6-9
'
'
Imports System.Runtime.InteropServices
   
Module SHFileCtrl
   
#Region "API's"
   
'------------------------------
'查看文件属性API
Public Structure SHELLEXECUTEINFO
Dim cbSize As Integer
Dim fMask As Integer
Dim hwnd As IntPtr
Dim lpVerb As String
Dim lpFile As String
Dim lpParameters As String
Dim lpDirectory As String
Dim nShow As Integer
Dim hInstApp As IntPtr
Dim lpIDList As IntPtr
Dim lpClass As String
Dim hkeyClass As IntPtr
Dim dwHotKey As Integer
Dim hIcon As IntPtr
Dim hProcess As IntPtr
End Structure
    
' 显示方式
'Private Const SW_HIDE = 0
'Private Const SW_SHOWNORMAL = 1
'Private Const SW_SHOWMINIMIZED = 2
'Private Const SW_SHOWMAXIMIZED = 3
'Private Const SW_MAXIMIZE = 3
'Private Const SW_SHOWNOACTIVATE = 4
'Private Const SW_SHOW = 5
'Private Const SW_MINIMIZE = 6
Private Const SW_SHOWMINNOACTIVE = 7
'Private Const SW_SHOWNA = 8
'Private Const SW_RESTORE = 9
   
'
'Private Const SEE_MASK_CLASSKEY = &H3
'Private Const SEE_MASK_CLASSNAME = &H1
'Private Const SEE_MASK_CONNECTNETDRV = &H80
'Private Const SEE_MASK_DOENVSUBST = &H200
'Private Const SEE_MASK_FLAG_DDEWAIT = &H100
Private Const SEE_MASK_FLAG_NO_UI = &H400
'Private Const SEE_MASK_HOTKEY = &H20
'Private Const SEE_MASK_ICON = &H10
'Private Const SEE_MASK_IDLIST = &H4
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Const SEE_MASK_NOCLOSEPROCESS = &H40
   
Private Declare Function ShellExecuteEx Lib "shell32.dll" (ByRef lpShellInfo As SHELLEXECUTEINFO As Integer
   
#End Region
   
'显示属性对话框
'参数
'hWnd IntPtr 父窗体句柄
'sFile String 要查看属性的文件
'调用:ShowPropertie(Me.Handle, sFile)
Public Sub ShowPropertie(ByVal hWnd As IntPtr, ByVal sFile As String)
   
    Dim sInfo As New SHELLEXECUTEINFO
    Dim iRet As Integer
   
    Try
        With sInfo
            .cbSize = Marshal.SizeOf(sInfo)
            .fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_INVOKEIDLIST Or SEE_MASK_FLAG_NO_UI
            .hwnd = hWnd
            .lpVerb = "properties"
            .lpFile = sFile
            .lpParameters = ""
            .lpDirectory = vbNullString
            .nShow = SW_SHOWMINNOACTIVE
            .hInstApp = New IntPtr(0)
            .lpIDList = New IntPtr(0)
            .lpClass = vbNullString
            .hkeyClass = New IntPtr(0)
            .dwHotKey = 0
            .hIcon = New IntPtr(0)
            .hProcess = New IntPtr(0)
        End With
   
        iRet = ShellExecuteEx(sInfo)
   
    Catch ex As Exception
        MsgBox(iRet & vbCrLf & Err.ToString)
    End Try
End Sub
   
End Module


扫描二维码推送至手机访问。

版权声明:本文由海阔天空发布,如需转载请注明出处。

本文链接:https://www.apull.net/html/20070609250.html

分享给朋友:

相关文章

VB获取光驱盘符

VB获取光驱盘符

VB获取光驱盘符Option Explicit Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" _ (ByVal nDrive As String) As Long 'GetLogicalDriveStrings-->获取一个字串,其中包含了当前所有逻辑驱动器的根驱动器路径 Private Declare Function GetLogicalDriveStri...

 C++ string类常用函数

C++ string类常用函数

string类的构造函数:string(const char *s);    //用c字符串s初始化 string(int n,char  c);     //用n个字符c初始化此外,string类还支持默认构造函数和复制构造函数,如string s1;string  s2="hello";都是正确的写法。...

常用asp函数

常用asp函数

<% '------------------------------------- '所有功能函数名如下: ' StrLength(str) 取得字符串长度 ' CutStr(str,strlen) 字符串长度切割 ' CheckIsEmpty(tstr) 检测是否为空 ' isInteger(para) 整数检验 ' CheckName(str) 名字字符校验 ' CheckPassword(str) 密码检验 ' CheckEmail(emai...

计算机蓝屏代码的含义

计算机蓝屏代码的含义

0 0x0000 作业完成。1 0x0001 不正确的函数。2 0x0002 系统找不到指定的档案。3 0x0003 系统找不到指定的路径。4 0x0004 系统无法开启档案。5 0x0005 拒绝存取。6 0x0006 无效的代码。7 0x0007 储存体控制区块已毁。8 0x0008 储存体空间不足,无法处理这个指令。9 0x0009 储存体控制区块地址无效。10 0x000A 环境不正确。11 0x000B 尝试加载一个格式错误的程序。12 0x000C 存取码错误。1...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。