|
|
|
|
|
Dicas
|
|
Visual Basic (Arquivos/Diretórios)
|
|
|
Título da Dica: Chamando a Janela Propriedade de um Arquivo
|
|
|
|
Postada em 16/10/2003 por ^HEAVY-METAL^
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 'Optional parameter lpClass As String 'Optional parameter hkeyClass As Long 'Optional parameter dwHotKey As Long 'Optional parameter hIcon As Long 'Optional parameter hProcess As Long 'Optional parameter End Type
Const SEE_MASK_INVOKEIDLIST = &HC Const SEE_MASK_NOCLOSEPROCESS = &H40 Const SEE_MASK_FLAG_NO_UI = &H400
Declare Function ShellExecuteEX Lib "shell32.dll" Alias "ShellExecuteEx" _ (SEI As SHELLEXECUTEINFO) As Long
Public Function ShowProperties(filename As String, OwnerhWnd As Long) As Long
Dim SEI As SHELLEXECUTEINFO Dim r As Long With SEI .cbSize = Len(SEI) .fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_INVOKEIDLIST Or SEE_MASK_FLAG_NO_UI .hwnd = OwnerhWnd .lpVerb = "properties" .lpFile = filename .lpParameters = vbNullChar .lpDirectory = vbNullChar .nShow = 0 .hInstApp = 0 .lpIDList = 0 End With
' 'Call the API r = ShellExecuteEX(SEI)
' 'Return the instance handle As a sign of success ShowProperties = SEI.hInstApp
End Function
'Paste the following into a Command button, etc. 'Needs one textbox named Text1 Dim r As Long Dim fname As String ' 'Get the filename And path from Text1 fname = (Text1) ' 'show the properties dialog, passing the filename ' 'And the owner of the dialog r = ShowProperties(fname, Me.hwnd) ' 'Display an Error message If things didn't go As planned If r <= 32 Then Msgbox "Error"
|
|
|
|
|