• Martes 7 de Mayo de 2024, 18:05

Autor Tema:  Propiedades De Un Fichero  (Leído 830 veces)

ROBER.29

  • Miembro MUY activo
  • ***
  • Mensajes: 421
    • Ver Perfil
    • http://www.contrapixel.com
Propiedades De Un Fichero
« en: Lunes 12 de Enero de 2004, 13:02 »
0
Alguien sabe si existe una forma de poder utilizar la ventana de propiedades de un fichero del windows en nuestras aplicaciones?

He estado buscando si existía alguna API específica pero no la ha encontrado. Supongo q existirá alguna a la cual se la pase la ruta de un fichero y nos muestre la ventana de windows con las propiedades del mismo.

Gracias por su atención.

Saludos.
Roberto García
Moderador de Visual Basic.
Gerente
[contra]PixeL S.L.
Valladolid

ROBER.29

  • Miembro MUY activo
  • ***
  • Mensajes: 421
    • Ver Perfil
    • http://www.contrapixel.com
Re: Propiedades De Un Fichero
« Respuesta #1 en: Lunes 12 de Enero de 2004, 13:38 »
0
Ya he encontrado la solución. Es de la siguiente forma:


Código: Text
  1.  
  2. \'#VBIDEUtils#***********************************************
  3. \' * Programmer Name  : Waty Thierry
  4. \' * Web Site         : www.geocities.com/ResearchTriangle/6311/
  5. \' * E-Mail           : waty.thierry@usa.net
  6. \' * Date             : 28/06/99
  7. \' * Time             : 13:16
  8. \' ********************************************************
  9. \' * Comments         : Showing the Properties dialog box
  10. \' *
  11. \' * This tip demonstrates how To use the Win32 API To
  12. \' * bring up the explorer properties
  13. \' * dialog box For a specified file.
  14. \' * This API Function has the same effect As Right
  15. \' * clicking On a file In Windows 95 And selecting properties.
  16.  
  17. \' **************************************************
  18. Option Explicit
  19.  
  20. Private Type SHELLEXECUTEINFO
  21.     cbSize As Long
  22.     fMask As Long
  23.     hwnd As Long
  24.     lpVerb As String
  25.     lpFile As String
  26.     lpParameters As String
  27.     lpDirectory As String
  28.     nShow As Long
  29.     hInstApp As Long
  30.     lpIDList As Long
  31.     lpClass As String
  32.     hkeyClass As Long
  33.     dwHotKey As Long
  34.     hIcon As Long
  35.     hProcess As Long
  36. End Type
  37.  
  38. Private Const SEE_MASK_INVOKEIDLIST = &HC
  39. Private Const SEE_MASK_NOCLOSEPROCESS = &H40
  40. Private Const SEE_MASK_FLAG_NO_UI = &H400
  41.  
  42. Private Declare Function ShellExecuteEX Lib \"shell32.dll\" Alias \"ShellExecuteEx\" (SEI As SHELLEXECUTEINFO) As Long
  43.  
  44. Public Function ShowProps(FileName As String, OwnerhWnd As Long) As Boolean
  45.  
  46. \'USAGE:
  47. \'To show the properties dialog box of \"c:\\autoexec.bat\", use the following code:
  48. \'Call ShowProps(\"c:\\autoexec.bat\", Me.hwnd)
  49. \'Function will return false if
  50. \'property windows can\'t be shown for
  51. \'any reason (e.g., invalid file or Ownerhwnd)
  52.  
  53.  
  54.     On Error Resume Next
  55.     Dim SEI As SHELLEXECUTEINFO
  56.     Dim r As Long
  57.     With SEI
  58.         .cbSize = Len(SEI)
  59.         .fMask = SEE_MASK_NOCLOSEPROCESS Or _
  60.          SEE_MASK_INVOKEIDLIST Or SEE_MASK_FLAG_NO_UI
  61.         .hwnd = OwnerhWnd
  62.         .lpVerb = \"properties\"
  63.         .lpFile = FileName
  64.         .lpParameters = vbNullChar
  65.         .lpDirectory = vbNullChar
  66.         .nShow = 0
  67.         .hInstApp = 0
  68.         .lpIDList = 0
  69.     End With
  70.     r = ShellExecuteEX(SEI)
  71.     ShowProps = r
  72. End Function
  73.  
  74.  

Saludos.
Roberto García
Moderador de Visual Basic.
Gerente
[contra]PixeL S.L.
Valladolid