How to get file attributes using unit shlobj ? lazarus / 34-Windows ---------------------------------------------------------------------- Borneq · 2020-01-29 19:07 I can walk through folders starting at SHGetDesktopFolder, next I do SHGetSpecialFolderLocation, next FIDesktopFolder.BindToObject and ShellFolder.EnumObjects. I can get path and display name by ShellFolder.GetDisplayNameOf. But how can file size and file modification time? Is struct FILEDESCRIPTOR but i can't find any function that uses it. ---------------------------------------------------------------------- Remy Lebeau · 2020-01-29 19:27 Quote from: Borneq on January 29, 2020, 08:07:43 pmBut how can file size and file modification time? You can use IShellFolder.BindToStorage() and then IStorage.Stat() or IStream.Stat(). Or, have a look at IShellFolder2, which has GetDetailsOf() and GetDetailsEx() methods. Or, consider using IShellItem instead of IShellFolder.  IShellFolder is an old API.  IShellItem2 has GetFileTime() and GetUInt64(PKEY_Size) methods. Otherwise, you can just use the filesystem API instead, using the path you retrieve from each shell item to call GetFileSize() and GetFileTime(), or GetFileAttributesEx(GetFileExInfoStandard). ---------------------------------------------------------------------- Borneq · 2020-01-29 19:33 In ShellApi unit are SHGetFileInfo functions (is needed path). I try use newer IShellItem but I don't see IShellItem2, only Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     PIShellItem= ^IShellItem;    IShellItem = interface(IUnknown)             ['{43826d1e-e718-42ee-bc55-a1e261c37bfe}']               function BindToHandler(pbc:IBindCTX;bhid:PGUID;RIID:PIID;ppv:ppointer):HResult; Stdcall;                         function GetParent(ppsi:PISHellItem):HResult;Stdcall;               function GetDisplayName(sigdnname:SIGDN;ppszName:LPWSTR):HResult; Stdcall;             function GetAttributes(sfgaomask:SFGAOF;psfgaoAttribs:PSFGAOF ):HResult;Stdcall;               function Compare(psi:IShellItem;hint:SICHINTF;piorder:PINT):HResult; Stdcall;             end; ---------------------------------------------------------------------- Borneq · 2020-01-29 19:52 I get it from https://raw.githubusercontent.com/tpn/winsdk- 10/master/Include/10.0.16299.0/um/ShObjIdl_core.h if Windows 7 and Windows 8 handle it? ---------------------------------------------------------------------- Remy Lebeau · 2020-02-01 02:38 Quote from: Borneq on January 29, 2020, 08:33:10 pmIn ShellApi unit are SHGetFileInfo functions (is needed path). That function does not provide the information you are asking for (file size, modification time, etc). Quote from: Borneq on January 29, 2020, 08:33:10 pmI try use newer IShellItem but I don't see IShellItem2 Then you will have to define it manually in your own code, based on the definition provided on MSDN, or I'm sure you can find a Pascal translation online if you look around.