如果在explore里选择缩略图的显示方式,会生成thumb.db文件,如何取得其中的缩略图?试过IExtractImage,用GetUIObject的时候总是失败。
解决方案 »
- odbc访问access数据库 cdatabase类对象的定义
- 帮帮我,为什么程序运行了之后没有对话框,只有对话框上的控件
- 老问题了,关于sendmessage和postmessage的问题了,不过请大虾耐心看完问题。
- 用WinIo.lib读bios时在加载库时总失败 InitializeWinIo()总返回 FALSE,为什么啊
- 从水源听说jennyvenus老大当MVP了,恭喜~
- 我在框架中创建一个DialogBar,能够接收OnCreate消息,但无法接收OnInitDialog消息?
- 如何学好VC++?
- 设置字体的问题?
- 紧急求助: 网上哪有专门关于ATL的书可下载?
- gif,jpeg问题?
- 急着帮忙看看!!
- vc 的SDK 编程,,突发奇想...猜测MFC 模式所写的一段SDK代码,,很短,,编译通不过.....
http://www.codeproject.com/listctrl/thumbnail.asp
GetLocation Used to request the path description of an image and specify how the image should be rendered. ResThere are two steps to the process. First, use GetLocation to request the path description of an image and specify how the image should be rendered. Then, call Extract to extract the image.If the object is free-threaded it must also expose an IRunnableTask interface, so it can be stopped and started as needed. This feature can be particularly useful when extraction may be slow.Implement IExtractImage if your namespace extension needs to provide thumbnail images to be displayed in a Shellview. Use IExtractImage if you are implementing a view of namespace objects, and want to display thumbnail images. You can use a Shell folder's IShellFolder::GetUIObjectOf method to bind to its IExtractImage interface.Interface InformationMinimum DLL Version shell32.dll version 4.70 or later
Custom Implementation No
Inherits from IUnknown
Header shobjidl.h
Minimum operating systems Windows 2000, Millennium
你出什么错,帮你看看,是不是OS的版本不对
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B298608
You Can View an NTFS Encrypted File in Thumbnail ViewHRESULT CFileThumbExtract::CreateThumbnail(DWORD dwWidth, DWORD dwHeight, HBITMAP* pThumbnail)
{
LPITEMIDLIST pidlItems = NULL, pidlURL = NULL, pidlWorkDir = NULL;
HRESULT hr;
WCHAR pszPath[MAX_PATH];
DWORD dwPriority = 0, dwFlags = IEIFLAG_ASPECT;
SIZE size = { dwWidth, dwHeight };
IExtractImage* peiURL = NULL;
IShellFolder* psfDesktop = NULL;
IShellFolder* psfWorkDir = NULL; basic_string<WCHAR> wsDir,wsFile,wsTempFile; hr = SHGetDesktopFolder(&psfDesktop);
if(FAILED(hr)) goto OnExit; // create shortcut if URL
if(PathIsURLW(m_wsPath.c_str())) {
wsTempFile = m_wsTempPath; wsTempFile += TEMP_URL;
if(!CreateURLShortcut(m_wsPath.c_str(), wsTempFile.c_str())) goto OnExit;
wsDir = m_wsTempPath;
wsFile = TEMP_URL;
}
else {
wsDir = m_wsDir;
wsFile = m_wsFile;
}
// get working directory
wcscpy(m_wsBuffer,wsDir.c_str());
hr = psfDesktop->ParseDisplayName(NULL, NULL, m_wsBuffer, NULL, &pidlWorkDir, NULL);
if(FAILED(hr)) goto OnExit;
hr = psfDesktop->BindToObject(pidlWorkDir, NULL, IID_IShellFolder, (LPVOID*)&psfWorkDir);
if(FAILED(hr)) goto OnExit;
psfDesktop->Release();
psfDesktop = NULL;
m_pMalloc->Free(pidlWorkDir);
pidlWorkDir = NULL; // retrieve link information
wcscpy(m_wsBuffer,wsFile.c_str());
hr = psfWorkDir->ParseDisplayName(NULL, NULL, m_wsBuffer, NULL, &pidlURL, NULL);
if(FAILED(hr)) goto OnExit;
// query IExtractImage
hr = psfWorkDir->GetUIObjectOf(NULL, 1, (LPCITEMIDLIST*)&pidlURL, IID_IExtractImage, NULL, (LPVOID*)&peiURL);
if(FAILED(hr)) goto OnExit;
// define thumbnail properties
hr = peiURL->GetLocation(pszPath, MAX_PATH, &dwPriority, &size, 16, &dwFlags);
if(FAILED(hr)) goto OnExit;
// generate thumbnail
hr = peiURL->Extract(pThumbnail);
if(FAILED(hr)) goto OnExit; // clean-up IExtractImage
peiURL->Release();
peiURL = NULL;OnExit: // free allocated structures
if(peiURL != NULL) peiURL->Release();
if(pidlURL != NULL) m_pMalloc->Free(pidlURL);
if(pidlWorkDir != NULL) m_pMalloc->Free(pidlWorkDir);
if(psfDesktop != NULL) psfDesktop->Release();
if(psfWorkDir != NULL) psfWorkDir->Release();
return hr;
}