Explorer
-
Hello, I want to create application like windows explorer. I think I can use builtin tree and builtin list view. I think there are some interface IShellFolderTree or IShellFolderList. Can you please guide me with any example/article?
-
Hello, I want to create application like windows explorer. I think I can use builtin tree and builtin list view. I think there are some interface IShellFolderTree or IShellFolderList. Can you please guide me with any example/article?
The
IShellFolder
interface is mainly used to manage folders and provide data for clipboard and drag & drop. I suggest to start without using that and implement the tree and list views using standard API functions likeFindFirstFileEx
andFindNextFile
which provide basic information like size, time stamps and attributes. For additional info like icons and file types useSHGetFileInfo
. To get the owner name for a file or directory useGetNamedSecurityInfo
andLookupAccountSid
. Solutions to resolve reparse points (links and mounts) can be found in the web (open withCreateFile
with flagsFILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT
and callDeviceIoControl
withFSCTL_GET_REPARSE_POINT
). To use theIShellFolder
interface you have to get the DesktopFolder and use that to bind to other folders:LPSHELLFOLDER pDesktopFolder;
::SHGetDesktopFolder(&pDesktopFolder);LPSHELLFOLDER psfFolder = NULL;
LPITEMIDLIST pFolderPIDL = ::ILCreateFromPath(lpszPath);
HRESULT hRes = pDesktopFolder->BindToObject(
pFolderPIDL,
NULL,
IID_IShellFolder,
IID_PPV_ARGS(&psfFolder)
);// Example to get the PIDL of a named file or folder within a folder
// This PIDL can then be used for other IShellFolder operations
LPITEMIDLIST pPIDL;
CString strName; // name within folder
hRes = psfFolder->ParseDisplayName(
NULL, // no hWnd necessary when showing no dialog
NULL, // no bind context
strName.GetBuffer(), // non-const LPWSTR
NULL, // no need to get number of parsed characters
&pPIDL, // PIDL relative to the parsing folder
NULL // attributes not used
);
strName.ReleaseBuffer();// Releasing
::CoTaskMemFree(pPIDL);
psfFolder->Release();
::ILFree(pFolderPIDL);
pDesktopFolder->Release();As you can see there are lot of tasks where some are quite complex.
-
Hello, I want to create application like windows explorer. I think I can use builtin tree and builtin list view. I think there are some interface IShellFolderTree or IShellFolderList. Can you please guide me with any example/article?
Hi, It's alot of work and you will need alot of COM[^] and shell expertise[^]. Have a look at the explorer clone by David Erceg: Explorer++ is a small and fast file manager for Windows.[^] It comes with full source code.[^] Best Wishes, -David Delaune