MyList.cpp
上传用户:shouhua
上传日期:2014-12-06
资源大小:5685k
文件大小:2k
- // MyList.cpp : implementation file
- //
- #include "stdafx.h"
- #include "AntiEvilTools.h"
- #include "MyList.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // MyList
- MyList::MyList()
- {
- }
- MyList::~MyList()
- {
- }
- BEGIN_MESSAGE_MAP(MyList, CListCtrl)
- //{{AFX_MSG_MAP(MyList)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // MyList message handlers
- bool MyList::InitSystemImageLists(HWND hwndList)
- {
- SHFILEINFO sfi;
- HIMAGELIST himlSmall = (HIMAGELIST)::SHGetFileInfo( "C:\", 0, &sfi,
- sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON );
- HIMAGELIST himlLarge = (HIMAGELIST)::SHGetFileInfo( "C:\", 0, &sfi,
- sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_LARGEICON );
- if( himlSmall && himlLarge ) {
- ListView_SetImageList(hwndList, himlSmall, LVSIL_SMALL);
- ListView_SetImageList(hwndList, himlLarge, LVSIL_NORMAL);
- return TRUE;
- }
- return FALSE;
- }
- int MyList::GetFileIcon(LPCTSTR lpFileName)
- {
- SHFILEINFO sfi;
- SHGetFileInfo(lpFileName, 0, &sfi, sizeof(sfi), SHGFI_ICON|SHGFI_SMALLICON|SHGFI_LARGEICON);
- return sfi.iIcon;
- }
- void MyList::SetFolder(CString sFile)
- {
- /*int index;
- if (sFile == "") return ; //如果地址为空,则返回
- m_strPath = sFile;
- //CImageList * imageList = m_SysImageList.GetImageList( FALSE );
- SetImageList(imageList, LVSIL_NORMAL);
- CFileFind finder;
- int bWorking = finder.FindFile(sFile+"*.*");
- if( bWorking ) {
- DeleteAllItems();
- }
- else return;
- while( bWorking ) {
- bWorking = finder.FindNextFile();
- if(!finder.IsDots())
- {
- HICON icon = m_SysImageList.GetIcon(sFile+finder.GetFileName(),FALSE,FALSE);
- index = imageList->Add(icon);
- InsertItem( 1, sFile+finder.GetFileName(), index );
- }
- }*/
- }