資源簡介
很好的縮略圖顯示和查看處理,對初學者很有幫助。

代碼片段和文件信息
//?FoldersTreeCtrl.cpp?:?implementation?file
//
#include?“stdafx.h“
#include?“FoldersTreeCtrl.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CFoldersTreeCtrl
CFoldersTreeCtrl::CFoldersTreeCtrl()
{
}
CFoldersTreeCtrl::~CFoldersTreeCtrl()
{
}
BEGIN_MESSAGE_MAP(CFoldersTreeCtrl?CTreeCtrl)
//{{AFX_MSG_MAP(CFoldersTreeCtrl)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CFoldersTreeCtrl?message?handlers
LPITEMIDLIST?CFoldersTreeCtrl::Next(LPCITEMIDLIST?pidl)
{
LPSTR?lpMem?=?(?LPSTR?)pidl;
lpMem?+=?pidl->mkid.cb;
return?(?LPITEMIDLIST?)lpMem;
}
UINT?CFoldersTreeCtrl::GetSize(LPCITEMIDLIST?pidl)
{
????UINT?cbTotal?=?0;
????if(?pidl?)
????{
????????cbTotal?+=?sizeof(?pidl->mkid.cb?);
????
while(?pidl->mkid.cb?)
????????{
????????????cbTotal?+=?pidl->mkid.cb;
????????????pidl????=?Next(?pidl?);
????????}
????}
????return?cbTotal;
}
LPITEMIDLIST?CFoldersTreeCtrl::CreatePidl(?UINT?cbSize?)
{
????LPMALLOC?????lpMalloc;
????HRESULT??????hr;
????LPITEMIDLIST?pidl=NULL;
????hr?=?SHGetMalloc(&lpMalloc);
????if(?FAILED(hr)?)
{
return?0;
}
????pidl?=?(LPITEMIDLIST)lpMalloc->Alloc(cbSize);
????if(?pidl?)
{
????????memset(pidl?0?cbSize);???
}
????if(?lpMalloc?)
{
lpMalloc->Release();
}
????return?pidl;
}
LPITEMIDLIST?CFoldersTreeCtrl::ConcatPidls(LPCITEMIDLIST?pidl1?LPCITEMIDLIST?pidl2)
{
????LPITEMIDLIST?pidlNew;
????UINT?????????cb1;
????UINT?????????cb2;
????if(?pidl1?)?
{
cb1?=?GetSize(pidl1)?-?sizeof(pidl1->mkid.cb);
}
????else
{
cb1?=?0;
}
????cb2?=?GetSize(pidl2);
????pidlNew?=?CreatePidl(cb1?+?cb2);
????
if(?pidlNew?)
????{
????????if(?pidl1?)
{
memcpy(pidlNew?pidl1?cb1);
}
????????memcpy(((LPSTR)pidlNew)?+?cb1?pidl2?cb2);
????}
????return?pidlNew;
}
LPITEMIDLIST?CFoldersTreeCtrl::CopyITEMID(LPMALLOC?lpMalloc?LPITEMIDLIST?lpi)
{
LPITEMIDLIST?lpiTemp;
lpiTemp?=?(LPITEMIDLIST)lpMalloc->Alloc(lpi->mkid.cb+sizeof(lpi->mkid.cb));
CopyMemory((PVOID)lpiTemp?(CONST?VOID?*)lpi?lpi->mkid.cb+sizeof(lpi->mkid.cb));
return?lpiTemp;
}
BOOL?CFoldersTreeCtrl::GetName(?LPSHELLFOLDER?lpsf
????????LPITEMIDLIST??lpi
DWORD?????????dwFlags
LPSTR?????????lpFriendlyName?)
{
BOOL???bSuccess=TRUE;
STRRET?str;
if(?NOERROR?==?lpsf->GetDisplayNameOf(?lpidwFlags?&str?)?)
{
switch(?str.uType?)
{
case?STRRET_WSTR:
????????????WideCharToMultiByte(?CP_ACP?
?????????????????0 ???????????????
?str.pOleStr??????????
?-1???????????????????
?lpFriendlyName???????
?MAX_PATH
?NULL???????????????????
?NULL?);??????????????????
break;
case?STRRET_OFFSET:
lstrcpy(?lpF
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????811008??2005-03-29?10:53??TreeList01\Debug\cximagecrt.dll
?????文件????3432532??2008-09-08?11:14??TreeList01\Debug\cximagecrtd.dll
?????文件?????852038??2008-09-08?11:14??TreeList01\Debug\demoddll.exe
?????文件??????41087??2010-12-13?22:28??TreeList01\Debug\FoldersTreeCtrl.obj
?????文件??????36561??2010-12-13?22:28??TreeList01\Debug\MainFrm.obj
?????文件?????131252??2010-12-13?22:28??TreeList01\Debug\StdAfx.obj
?????文件?????151621??2010-12-13?22:28??TreeList01\Debug\ThumbView.exe
?????文件???????5014??2010-12-13?22:28??TreeList01\Debug\ThumbView.exp
?????文件?????514576??2010-12-13?22:28??TreeList01\Debug\ThumbView.ilk
?????文件???????9282??2010-12-13?22:28??TreeList01\Debug\ThumbView.lib
?????文件?????443392??2010-12-13?22:28??TreeList01\Debug\ThumbView.pdb
?????文件??????44223??2010-12-13?22:28??TreeList01\Debug\TreeList01.obj
?????文件????5807092??2010-12-13?22:28??TreeList01\Debug\TreeList01.pch
?????文件???????7056??2010-12-13?22:28??TreeList01\Debug\TreeList01.res
?????文件??????31557??2010-12-13?22:28??TreeList01\Debug\TreeList01Doc.obj
?????文件?????106551??2010-12-13?22:28??TreeList01\Debug\TreeList01View.obj
?????文件?????238592??2014-08-01?11:28??TreeList01\Debug\vc60.idb
?????文件?????421888??2010-12-13?22:28??TreeList01\Debug\vc60.pdb
?????文件??????10107??2003-09-22?16:05??TreeList01\FoldersTreeCtrl.cpp
?????文件???????2001??2003-09-22?16:09??TreeList01\FoldersTreeCtrl.h
?????文件???????2663??2005-03-29?10:53??TreeList01\include\xfile.h
?????文件???????1805??2005-03-29?10:53??TreeList01\include\ximacfg.h
?????文件???????3772??2005-03-29?10:53??TreeList01\include\ximadef.h
?????文件??????24080??2005-03-29?10:53??TreeList01\include\ximage.h
?????文件???????2624??2005-03-29?10:53??TreeList01\include\xiofile.h
?????文件????????900??2005-03-29?10:53??TreeList01\include\xmemfile.h
?????文件?????133160??2005-03-29?10:53??TreeList01\lib\cximagecrt.lib
?????文件?????133590??2005-03-29?10:53??TreeList01\lib\cximagecrtd.lib
?????文件???????2511??2008-09-08?20:57??TreeList01\MainFrm.cpp
?????文件???????1581??2008-09-08?20:57??TreeList01\MainFrm.h
............此處省略30個文件信息
評論
共有 條評論