module1.bas

来自「用ListView控件列出所有驱动器信息」· BAS 代码 · 共 58 行

BAS
58
字号
Attribute VB_Name = "Module1"
Option Explicit
'*** This example is provided to you by
'*** Geir Waalbakken Hope you like it.
'***

Public Const SEE_MASK_INVOKEIDLIST = &HC
Public Const SEE_MASK_NOCLOSEPROCESS = &H40
Public Const SEE_MASK_FLAG_NO_UI = &H400

Public Const SEE_MASK_CONNECTNETDRV = &H80
'Public Const SEE_MASK_IDLIST = &H4

Type SHELLEXECUTEINFO
    cbSize As Long
    fMask As Long
    hwnd As Long
    lpVerb As String
    lpFile As String
    lpParameters As String
    lpDirectory As String
    nShow As Long
    hInstApp As Long
    lpIDList As Long
    lpClass As String
    hkeyClass As Long
    dwHotKey As Long
    hIcon As Long
    hProcess As Long
End Type
'*** Get the Properties (DialogBox) (Got I it from a friend oof mine I hope this is usefull to you
'*** ShellExecuteEX Does a lot of cool stuff here is one.
'*** You can also use this to get the file properties fore  files
Public Declare Function ShellExecuteEX Lib "shell32.dll" Alias "ShellExecuteEx" (SEI As SHELLEXECUTEINFO) As Long

Public Sub GetFileOrDiskProps(lHwnd As Long, FileName As String)
    Dim SEI As SHELLEXECUTEINFO
    Dim lReturn As Long
    Dim Reply As Integer
    
    With SEI
        .cbSize = Len(SEI)
        .fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_CONNECTNETDRV _
         Or SEE_MASK_INVOKEIDLIST  ' Or SEE_MASK_FLAG_NO_UI
        .hwnd = lHwnd              ' If you use this
        .lpVerb = "properties"     ' You won't see the messagebox
        .lpFile = FileName
        .lpParameters = vbNullChar
        .lpDirectory = vbNullChar
        .nShow = 0
        .hInstApp = 0
        .lpIDList = 0
    End With
        lReturn = ShellExecuteEX(SEI)
End Sub


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?