Hello,
I'm trying to extract a thumbnail from the given file below.
![]()
For this I use SHCreateItemFromParsingName and IShellItem::BindToHandler. For several file types this works fine, but for various other file types BindToHandler only returns E_NOTIMPL Not implemented. and I am not sure why.
Normally thumbnails can be registered through thumbnail providers. Is there another method I am not aware of? This would explain why the example above fails. I stripped down the code to the absolut minimum:
#include <windows.h>
#include <shlobj.h>
#include <thumbcache.h>
#include <iostream>
#include <shellapi.h>
#pragma comment(lib, "SHELL32.LIB")
#pragma comment(lib, "Comctl32.lib")
int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (!SUCCEEDED(hr))
{
return -1;
}
IShellItem* psi = nullptr;
hr = SHCreateItemFromParsingName(argv[1], NULL, IID_PPV_ARGS(&psi));
if (SUCCEEDED(hr)) {
IThumbnailProvider* pThumbProvider;
hr = psi->BindToHandler(NULL, BHID_ThumbnailHandler, IID_PPV_ARGS(&pThumbProvider));
if (SUCCEEDED(hr)) {
std::wcout << L"this line never succeeds";
}
}
return 0;
}
Could anyone help out and explain what might go wrong here?