Call Windows API Shmultifileproperties to display rollup properties for multiple files

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.