新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private 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
Private Declare Function ShellExecuteEx Lib "shell32" (lpSEI As SHELLEXECUTEINFO) As Long
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Sub ShowFileProperties(ByVal aFile As String)
Dim sei As SHELLEXECUTEINFO
sei.hWnd = Me.hWnd
sei.lpVerb = "properties"
sei.lpFile = aFile
sei.fMask = SEE_MASK_INVOKEIDLIST
sei.cbSize = Len(sei)
ShellExecuteEx sei
End Sub
Private Sub Command1_Click()
Call ShowFileProperties(App.Path & "\manongku.txt")
End Sub
记得在当前目录放一个 manongku.txt 哦。