The code is as follows:1//csfilepath file path, delimited by | The number of npathes paths.
2voidCgetdirectorydlg::showpropertiesbypath (CString Csfilepath,intNpathes)
3{
4if(Csfilepath.isempty ())
5{
6return;
7}
8//Individual file Properties
9if(Npathes = =1)
Ten{
OneShellexecuteinfo sei;
AZeroMemory (&sei,sizeof(SEI));
-Sei.cbsize =sizeof(Shellexecuteinfo);
-Sei.hwnd = m_hwnd;
theSei.lpparameters = NULL;
-Sei.nshow =0;
-Sei.lpidlist = NULL;
-Sei.hinstapp =0;
+Sei.lpfile = Csfilepath;//file to display properties for
-Sei.lpverb = L"Properties";
+Sei.fmask = See_mask_idlist | see_mask_nocloseprocess | See_mask_invokeidlist |
A
atSEE_MASK_FLAG_NO_UI;
-ShellExecuteEx (&sei);
-return;
-}
-
-//multiple file attributes
in Lpitemidlist *pidldrives = (lpitemidlist *)malloc(sizeof(lpitemidlist) *npathes);
-ishellfolder* Psfdesktop;
toidataobject* PData;
+HRESULT hr;
-ULONG cheaten=0, dwattributes=0;
theintI=0;
*hr = SHGetSpecialFolderLocation (NULL, csidl_drives, pidldrives);
$if(SUCCEEDED (HR))
Panax Notoginseng{
-hr = Shgetdesktopfolder (&psfdesktop);
the Do{
+CString currentFilePath;
AintDelimitatorposition;
theDelimitatorposition = Csfilepath.find (L'|');
+if(Delimitatorposition = =-1)
-{
$Delimitatorposition = Csfilepath.getlength ();
$}
-currentFilePath = Csfilepath.left (delimitatorposition);
-Csfilepath.delete (0, Delimitatorposition +1);
thePsfdesktop->parsedisplayname (NULL,
-Null
WuyiCurrentfilepath.getbuffer (),
the&cheaten,
-(lpitemidlist*) &pidldrives[i],
Wu&dwattributes);
-i++;
About} while(!csfilepath.isempty () && i<npathes);
$
-if(SUCCEEDED (HR))
-{
-hr = Psfdesktop->getuiobjectof (NULL,
ANpathes,
+(lpcitemidlist*) Pidldrives,
theIid_idataobject,
-Null
$(void* *) &pdata);
theif(SUCCEEDED (HR))
the{
theCoInitialize (NULL);
thehr = Shmultifileproperties (PData,0);
-if(SUCCEEDED (HR))
in{
thePdata->release ();
the}
AboutCoUninitialize ();
the}
theif(Psfdesktop! = NULL)
the{
+Psfdesktop->release ();
-}
the}
Bayi for(i=0; i<npathes;i++)
the{
theIlfree (Pidldrives[i]);
-}
-}
the}
the
the // Call Method: Showpropertiesbypath (L "d:\\share\\v.txt| D:\\share\\sh.txt ", 2);
Call Windows API Shmultifileproperties to display rollup properties for multiple files