Hi,
Ive got a tabbed application with a file browsers on 2 of the tabs. One
starts up in C:\ and the other in My Documents. After the file list
control has added all the files into the control, it starts a thread
which generates a thumbnail preview for each of the files. In the second
thread, when i try to call GetLocation() for the pidl of C:\Documents
And Settings\<username>\My Documents\My Videos, it pauses for approx 4
seconds before returning successfully.
Does anyone know why this is happening or howto stop it / reduce the
amount of delay? The thing is, even though its in a separate thread, it
still freezes the main GUI!
Any help is much appreciated. Here is the extract icon code:
bool CFileListCtrl::ExtractThumbnailFromPIDL(IShellFolder*
pParentFolder, LPCITEMIDLIST pidl, CBitmap& bmpThumb)
{
CComPtr<IExtractImage> pExtract;
HRESULT hr = S_OK;
hr = pParentFolder->GetUIObjectOf(NULL, 1, &pidl, IID_IExtractImage,
NULL, (void**)&pExtract);
if (pExtract == NULL) // Early shell version, thumbs not supported
return false;
OLECHAR wszPathBuffer[MAX_PATH];
DWORD dwPriority = 0; // IEI_PRIORITY_NORMAL is defined nowhere!
DWORD dwFlags = IEIFLAG_SCREEN | IEIFLAG_OFFLINE;
HBITMAP hBmpImage = NULL;
SIZE szImage = {PREVIEW_WIDTH, PREVIEW_HEIGHT};
hr = pExtract->GetLocation(wszPathBuffer, MAX_PATH, &dwPriority,
&szImage, 32, &dwFlags);
// even if we've got shell v4.70+, not all files support thumbnails
if (hr == NOERROR)
hr = pExtract->Extract(&hBmpImage);
if (hBmpImage != NULL)
{
if (hr == NOERROR)
{
bmpThumb.Detach();
bmpThumb.Attach(hBmpImage); // This handle needs deleting eventually
return true;
}
else
::DeleteObject(hBmpImage);
}
return false;
}
Thanks