SlideShare a Scribd company logo
1 of 2
HRESULT CMyShellListCtrl::EnumObjects(LPSHELLFOLDER pParentFolder, LPITEMIDLIST
pidlParent)
{
ASSERT_VALID(this);
ASSERT_VALID(afxShellManager);
LPENUMIDLIST pEnum;
HRESULT hRes = pParentFolder->EnumObjects(NULL, m_nTypes, &pEnum);
if (SUCCEEDED(hRes))
{
LPITEMIDLIST pidlTemp;
DWORD dwFetched = 1;
LPAFX_SHELLITEMINFO pItem;
//enumerate the item's PIDLs
while (pEnum->Next(1, &pidlTemp, &dwFetched) == S_OK && dwFetched)
{
LVITEM lvItem;
ZeroMemory(&lvItem, sizeof(lvItem));
//fill in the TV_ITEM structure for this item
lvItem.mask = LVIF_PARAM | LVIF_TEXT | LVIF_STATE;
//AddRef the parent folder so it's pointer stays valid
pParentFolder->AddRef();
//put the private information in the lParam
pItem = (LPAFX_SHELLITEMINFO)GlobalAlloc(GPTR,
sizeof(AFX_SHELLITEMINFO));
pItem->pidlRel = pidlTemp;
pItem->pidlFQ = afxShellManager->ConcatenateItem(pidlParent,
pidlTemp);
pItem->pParentFolder = pParentFolder;
lvItem.lParam = (LPARAM)pItem;
lvItem.pszText = _T("");
int n = GetItemCount();
lvItem.iImage = OnGetItemIcon(n, pItem);
//determine if the item is shared
DWORD dwAttr = SFGAO_FOLDER | SFGAO_DISPLAYATTRMASK;// SFGAO_FOLDER
pParentFolder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidlTemp,
&dwAttr);
if (dwAttr & SFGAO_SHARE)
{
lvItem.mask |= LVIF_STATE;
lvItem.stateMask |= LVIS_OVERLAYMASK;
lvItem.state |= INDEXTOOVERLAYMASK(1); //1 is the index for the
shared overlay image
}
if (dwAttr & SFGAO_GHOSTED)
{
lvItem.mask |= LVIF_STATE;
lvItem.stateMask |= LVIS_CUT;
lvItem.state |= LVIS_CUT;
}
if (dwAttr & SFGAO_FOLDER)
{
//zipÀº À©µµ¿ì¿¡¼± Æú´õ·Î °£ÁֵDZ⠶§¹®¿¡ ¿©±â¼ ó¸®ÇØ¾ß ÇÔ.
}
else
{
SHFILEINFO sfi;
TCHAR szPath [MAX_PATH];
if (SHGetPathFromIDList(pItem->pidlFQ, szPath))
{
CFileStatus fs;
if (CFile::GetStatus(szPath, fs))
{
CString s = szPath;
int n = s.ReverseFind('.');
if(n!=-1)
{
s = s.Mid(n+1);
s.MakeLower();
if(s != _T("jpg"))
continue; }
}
}
}
int iItem = InsertItem(&lvItem);
if (iItem >= 0)
{
// Set columns:
const int nColumns = m_wndHeader.GetItemCount();
for (int iColumn = 0; iColumn < nColumns; iColumn++)
{
CString s = OnGetItemText(iItem, iColumn, pItem);
SetItemText(iItem, iColumn,s );
}
}
dwFetched = 0;
}
pEnum->Release();
}
return hRes;
}

More Related Content

What's hot (20)

week-14x
week-14xweek-14x
week-14x
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
 
Jarmo van de Seijp Shadbox ERC223
Jarmo van de Seijp Shadbox ERC223Jarmo van de Seijp Shadbox ERC223
Jarmo van de Seijp Shadbox ERC223
 
Tugas1
Tugas1Tugas1
Tugas1
 
Rcpp11 genentech
Rcpp11 genentechRcpp11 genentech
Rcpp11 genentech
 
week-4x
week-4xweek-4x
week-4x
 
week-16x
week-16xweek-16x
week-16x
 
BeepBeep 3: A declarative event stream query engine (EDOC 2015)
BeepBeep 3: A declarative event stream query engine (EDOC 2015)BeepBeep 3: A declarative event stream query engine (EDOC 2015)
BeepBeep 3: A declarative event stream query engine (EDOC 2015)
 
SLIME
SLIMESLIME
SLIME
 
Fuction call
Fuction callFuction call
Fuction call
 
Decision statements in c language
Decision statements in c languageDecision statements in c language
Decision statements in c language
 
S torage class in C
S torage class in CS torage class in C
S torage class in C
 
Metnum
MetnumMetnum
Metnum
 
Parsec
ParsecParsec
Parsec
 
week-11x
week-11xweek-11x
week-11x
 
C lecture 3 control statements slideshare
C lecture 3 control statements slideshareC lecture 3 control statements slideshare
C lecture 3 control statements slideshare
 
Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com
Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.comMcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com
Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com
 
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
 

Similar to 참고 코드(Shelllilst filtering)

Потоки в перле изнутри
Потоки в перле изнутриПотоки в перле изнутри
Потоки в перле изнутриIlya Zelenchuk
 
Creating windows store java script apps
Creating windows store java script appsCreating windows store java script apps
Creating windows store java script appsEugene Zharkov
 
Proxy OOP Pattern in PHP
Proxy OOP Pattern in PHPProxy OOP Pattern in PHP
Proxy OOP Pattern in PHPMarco Pivetta
 
Php7 hashtable
Php7 hashtablePhp7 hashtable
Php7 hashtable桐 王
 
This is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfThis is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfinfo334223
 
Introduction to ATS plugins
Introduction to ATS pluginsIntroduction to ATS plugins
Introduction to ATS pluginsPSUdaemon
 
Refactoring to symfony components
Refactoring to symfony componentsRefactoring to symfony components
Refactoring to symfony componentsMichael Peacock
 
In this lab, you will be given a simple code for a min Heap, and you.pdf
In this lab, you will be given a simple code for a min Heap, and you.pdfIn this lab, you will be given a simple code for a min Heap, and you.pdf
In this lab, you will be given a simple code for a min Heap, and you.pdfcharanjit1717
 
#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdf#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdfannucommunication1
 
CODE#include stdlib.h #include stdio.hstruct task{proce.pdf
CODE#include stdlib.h #include stdio.hstruct task{proce.pdfCODE#include stdlib.h #include stdio.hstruct task{proce.pdf
CODE#include stdlib.h #include stdio.hstruct task{proce.pdffathimalinks
 
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docxodiliagilby
 
implement the ListLinked ADT (the declaration is given in ListLinked.pdf
implement the ListLinked ADT (the declaration is given in ListLinked.pdfimplement the ListLinked ADT (the declaration is given in ListLinked.pdf
implement the ListLinked ADT (the declaration is given in ListLinked.pdfFOREVERPRODUCTCHD
 
Asynchronous java script
Asynchronous java scriptAsynchronous java script
Asynchronous java scriptRon Martin
 
I wrote the following change it to having a header, main and cpp fi.pdf
I wrote the following change it to having a header, main and cpp fi.pdfI wrote the following change it to having a header, main and cpp fi.pdf
I wrote the following change it to having a header, main and cpp fi.pdfrishteygallery
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacksmaamir farooq
 
Game unleashedjavascript
Game unleashedjavascriptGame unleashedjavascript
Game unleashedjavascriptReece Carlson
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdffantoosh1
 
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfAnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfanwarsadath111
 
I need help with the 2nd TODO comment and the other comments Ill.pdf
I need help with the 2nd TODO comment and the other comments Ill.pdfI need help with the 2nd TODO comment and the other comments Ill.pdf
I need help with the 2nd TODO comment and the other comments Ill.pdfEye2eyeopticians10
 
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docxajoy21
 

Similar to 참고 코드(Shelllilst filtering) (20)

Потоки в перле изнутри
Потоки в перле изнутриПотоки в перле изнутри
Потоки в перле изнутри
 
Creating windows store java script apps
Creating windows store java script appsCreating windows store java script apps
Creating windows store java script apps
 
Proxy OOP Pattern in PHP
Proxy OOP Pattern in PHPProxy OOP Pattern in PHP
Proxy OOP Pattern in PHP
 
Php7 hashtable
Php7 hashtablePhp7 hashtable
Php7 hashtable
 
This is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfThis is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdf
 
Introduction to ATS plugins
Introduction to ATS pluginsIntroduction to ATS plugins
Introduction to ATS plugins
 
Refactoring to symfony components
Refactoring to symfony componentsRefactoring to symfony components
Refactoring to symfony components
 
In this lab, you will be given a simple code for a min Heap, and you.pdf
In this lab, you will be given a simple code for a min Heap, and you.pdfIn this lab, you will be given a simple code for a min Heap, and you.pdf
In this lab, you will be given a simple code for a min Heap, and you.pdf
 
#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdf#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdf
 
CODE#include stdlib.h #include stdio.hstruct task{proce.pdf
CODE#include stdlib.h #include stdio.hstruct task{proce.pdfCODE#include stdlib.h #include stdio.hstruct task{proce.pdf
CODE#include stdlib.h #include stdio.hstruct task{proce.pdf
 
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx
__MACOSX._assign3assign3.DS_Store__MACOSXassign3._.D.docx
 
implement the ListLinked ADT (the declaration is given in ListLinked.pdf
implement the ListLinked ADT (the declaration is given in ListLinked.pdfimplement the ListLinked ADT (the declaration is given in ListLinked.pdf
implement the ListLinked ADT (the declaration is given in ListLinked.pdf
 
Asynchronous java script
Asynchronous java scriptAsynchronous java script
Asynchronous java script
 
I wrote the following change it to having a header, main and cpp fi.pdf
I wrote the following change it to having a header, main and cpp fi.pdfI wrote the following change it to having a header, main and cpp fi.pdf
I wrote the following change it to having a header, main and cpp fi.pdf
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
 
Game unleashedjavascript
Game unleashedjavascriptGame unleashedjavascript
Game unleashedjavascript
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdf
 
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfAnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
 
I need help with the 2nd TODO comment and the other comments Ill.pdf
I need help with the 2nd TODO comment and the other comments Ill.pdfI need help with the 2nd TODO comment and the other comments Ill.pdf
I need help with the 2nd TODO comment and the other comments Ill.pdf
 
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
 

참고 코드(Shelllilst filtering)

  • 1. HRESULT CMyShellListCtrl::EnumObjects(LPSHELLFOLDER pParentFolder, LPITEMIDLIST pidlParent) { ASSERT_VALID(this); ASSERT_VALID(afxShellManager); LPENUMIDLIST pEnum; HRESULT hRes = pParentFolder->EnumObjects(NULL, m_nTypes, &pEnum); if (SUCCEEDED(hRes)) { LPITEMIDLIST pidlTemp; DWORD dwFetched = 1; LPAFX_SHELLITEMINFO pItem; //enumerate the item's PIDLs while (pEnum->Next(1, &pidlTemp, &dwFetched) == S_OK && dwFetched) { LVITEM lvItem; ZeroMemory(&lvItem, sizeof(lvItem)); //fill in the TV_ITEM structure for this item lvItem.mask = LVIF_PARAM | LVIF_TEXT | LVIF_STATE; //AddRef the parent folder so it's pointer stays valid pParentFolder->AddRef(); //put the private information in the lParam pItem = (LPAFX_SHELLITEMINFO)GlobalAlloc(GPTR, sizeof(AFX_SHELLITEMINFO)); pItem->pidlRel = pidlTemp; pItem->pidlFQ = afxShellManager->ConcatenateItem(pidlParent, pidlTemp); pItem->pParentFolder = pParentFolder; lvItem.lParam = (LPARAM)pItem; lvItem.pszText = _T(""); int n = GetItemCount(); lvItem.iImage = OnGetItemIcon(n, pItem); //determine if the item is shared DWORD dwAttr = SFGAO_FOLDER | SFGAO_DISPLAYATTRMASK;// SFGAO_FOLDER pParentFolder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidlTemp, &dwAttr); if (dwAttr & SFGAO_SHARE) { lvItem.mask |= LVIF_STATE; lvItem.stateMask |= LVIS_OVERLAYMASK; lvItem.state |= INDEXTOOVERLAYMASK(1); //1 is the index for the shared overlay image } if (dwAttr & SFGAO_GHOSTED) { lvItem.mask |= LVIF_STATE; lvItem.stateMask |= LVIS_CUT; lvItem.state |= LVIS_CUT; }
  • 2. if (dwAttr & SFGAO_FOLDER) { //zipÀº À©µµ¿ì¿¡¼± Æú´õ·Î °£ÁֵDZ⠶§¹®¿¡ ¿©±â¼ ó¸®ÇØ¾ß ÇÔ. } else { SHFILEINFO sfi; TCHAR szPath [MAX_PATH]; if (SHGetPathFromIDList(pItem->pidlFQ, szPath)) { CFileStatus fs; if (CFile::GetStatus(szPath, fs)) { CString s = szPath; int n = s.ReverseFind('.'); if(n!=-1) { s = s.Mid(n+1); s.MakeLower(); if(s != _T("jpg")) continue; } } } } int iItem = InsertItem(&lvItem); if (iItem >= 0) { // Set columns: const int nColumns = m_wndHeader.GetItemCount(); for (int iColumn = 0; iColumn < nColumns; iColumn++) { CString s = OnGetItemText(iItem, iColumn, pItem); SetItemText(iItem, iColumn,s ); } } dwFetched = 0; } pEnum->Release(); } return hRes; }