View Full Version : How to read values in custom tab of file properties dialog box in windows.
J FelixBosco
03-18-2018, 06:44 AM
21855
 Please help me in getting the values shown in image. I googled for 5 days still couldn't find the solution. :(
YasserKhalil
03-18-2018, 08:46 AM
Can you give more details? upload the file with .dft extension?
Sub t()
Dim CP As Variant
'Dim CPS As Excel.CustomProperties
Dim X
For Each CP In CustomDocumentProperties
X = CP.Name
X = CP.Value
Next
For Each CP In BuiltinDocumentProperties
X = CP.Name
X = CP.Value
Next
End Sub
J FelixBosco
03-18-2018, 08:43 PM
Please find the attached file YasserKhalil. Thank you for your reply.
21857
J FelixBosco
03-18-2018, 09:12 PM
SamT please check this file 21858. Below is the code which i tried to get the custom properties of 1.dft file.
Private Declare Function getfileinfo Lib "kernel32.dll" Alias "GetFileInformationByHandleEx" (ByVal hFile As Integer, ByVal FileInformationClass As Long, ByRef lpFileInformation As FILE_ID_EXTD_DIR_INFO, ByVal dwBufferSize As Long) As Integer
Private Declare Function OpenFile Lib "kernel32.dll" (ByVal lpFileName As String, ByRef lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Private Declare Function er Lib "kernel32.dll" Alias "GetLastError" () As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal fHandle As Long) As Integer
'len with padding should be 40 bytes
'structure padding and packing
Private Const OFS_MAXPATHNAME = 128
Private Const OF_READWRITE = &H2
Private Const extendedFileInfo = &H13
'typedef struct _FILE_ID_EXTD_DIR_INFO {
'  ULONG         NextEntryOffset;
'  ULONG         FileIndex;
'  LARGE_INTEGER CreationTime;
'  LARGE_INTEGER LastAccessTime;
'  LARGE_INTEGER LastWriteTime;
'  LARGE_INTEGER ChangeTime;
'  LARGE_INTEGER EndOfFile;
'  LARGE_INTEGER AllocationSize;
'  ULONG         FileAttributes;
'  ULONG         FileNameLength;
'  ULONG         EaSize;
'  ULONG         ReparsePointTag;
'  FILE_ID_128   FileId;
'  WCHAR         FileName[1];
'} FILE_ID_EXTD_DIR_INFO, *PFILE_ID_EXTD_DIR_INFO;
'
'typedef struct _EXT_FILE_ID_128 {
'  BYTE Identifier[16];
'} EXT_FILE_ID_128, *PEXT_FILE_ID_128;
Private Type EXT_FILE_ID_128
    identifier(16) As Byte
End Type
Private Type FILE_ID_EXTD_DIR_INFO
    NextEntryOffset As Double
    FileIndex As Double
    CreationTime As Double
    LastAccessTime As Double
    LastWriteTime As Double
    ChangeTime As Double
    EndOfFile As Double
    AllocationSize As Double
    FileAttributes As Double
    FileNameLength As Double
    EaSize As Double
    ReparsePointTag As Double
    FileId As EXT_FILE_ID_128
    FileNameStartLetter As Integer
    
End Type
Private Type OFSTRUCT
    cBytes As Byte
    fFixedDisk As Byte
    nErrCode As Integer
    Reserved1 As Integer
    Reserved2 As Integer
    szPathname(0 To OFS_MAXPATHNAME - 1) As Byte '0-based
End Type
Private Type FILE_BASIC_INFORMATION
    CreationTime As Date
    LastcessTime As Date
    LastWriteTime As Date
    ChangeTime As Date
    FileAttribute As Double
End Type
Sub cc()
    Dim OFS As OFSTRUCT
    Dim hFile As Long
    Dim fileExtendedInfo As FILE_ID_EXTD_DIR_INFO
    Dim lSize As Long
    Dim sPath As String
    Dim retval As Integer
    
    
    sPath = "d:\cc\1.dft"
    lSize = 120 'LenB(fileExtendedInfo) '+padding
    hFile = OpenFile(sPath, OFS, OF_READWRITE)
    
  retval = getfileinfo(hFile, 19, fileExtendedInfo, lSize)
    
    Debug.Print er
    Debug.Print hFile
    Debug.Print retval
    Debug.Print
    Debug.Print fileExtendedInfo.AllocationSize
    Debug.Print fileExtendedInfo.ChangeTime
    Debug.Print fileExtendedInfo.CreationTime
    Debug.Print fileExtendedInfo.EaSize
    Debug.Print fileExtendedInfo.EndOfFile
    Debug.Print fileExtendedInfo.FileAttributes
    
    Debug.Print fileExtendedInfo.FileIndex
    Debug.Print fileExtendedInfo.FileIndex
    Debug.Print fileExtendedInfo.FileNameLength
    Debug.Print fileExtendedInfo.FileNameStartLetter
    Debug.Print fileExtendedInfo.LastAccessTime
    Debug.Print fileExtendedInfo.LastWriteTime
    Debug.Print fileExtendedInfo.NextEntryOffset
    Debug.Print fileExtendedInfo.ReparsePointTag
    
    retval = CloseHandle(hFile)
    Debug.Print er
    Debug.Print retval & " 'non-zero if succeeded"
    
 
End Sub
Is is possible to get those values in the image directly using windows libraries, like kernel32.dll, docprop.dll (docprop.dll appears in Dependency walker when I right click on 1.dft and go to properties and disappears when I exit properties dialog box.)?
J FelixBosco
03-19-2018, 10:33 PM
SamT your code may work on ms office files. But how to get custom properties of other files like this 21867
J FelixBosco
03-19-2018, 10:35 PM
Hi YasserKhalil got any ideas how to get the custom properties of 1.dft in 21868
YasserKhalil
03-20-2018, 04:37 AM
Waiting for experts. They must have ideas about the issue
Just be patient
J FelixBosco
03-20-2018, 05:02 AM
Sure YasserKhalil I'll be patient. :help
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.