Consulting

Results 1 to 10 of 10

Thread: How to read values in custom tab of file properties dialog box in windows.

  1. #1

    Question How to read values in custom tab of file properties dialog box in windows.

    custom tab.jpg
    Please help me in getting the values shown in image. I googled for 5 days still couldn't find the solution.

  2. #2
    Can you give more details? upload the file with .dft extension?

  3. #3
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    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
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  4. #4
    Please find the attached file YasserKhalil. Thank you for your reply.
    1.zip

  5. #5
    SamT please check this file 1.zip. 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.)?
    Last edited by J FelixBosco; 03-18-2018 at 11:04 PM.

  6. #6

    Question

    SamT your code may work on ms office files. But how to get custom properties of other files like this 1.zip

  7. #7

    Question

    Hi YasserKhalil got any ideas how to get the custom properties of 1.dft in 1.zip

  8. #8
    Waiting for experts. They must have ideas about the issue
    Just be patient

  9. #9
    Sure YasserKhalil I'll be patient.
    Last edited by J FelixBosco; 03-20-2018 at 07:41 AM.

  10. #10
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    :
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •