Ticket T864872
Visible to All Users

TcxShellListView - Show PDF thumbnails for newly-created folders like Windows Explorer does

created 5 years ago

I'm running into an issue with TcxShellListView where thumbnails are not showing for newly-created folders unless you first navigate to that folder in Windows Explorer and have it display the thumbnail images.

Steps to reproduce:

  1. Make sure you have a PDF viewer installed and set to show thumbnails in Windows Explorer.
  2. Create a simple shell app using the TcxShellListView, TcxShellTreeview and link them together. Set the view style of the shell list view to vsIcon and enable thumbnails in the shell list view. Run the app.
  3. In Windows Explorer create a new folder, set its view type to detail and copy some PDFs to this folder. I copied the files by right-clicking on the new folder and pasting them in instead of going into the folder directly, but I'm not sure if this is necessary.
  4. Navigate to this folder in the shell app. Instead of thumbnails you will see the default PDF icons.
  5. Go back to Windows Explorer, browse into this new folder, change its view to large icons so that Windows displays thumbnails.
  6. Go back to the shell app and hit F5 or renavigate to the folder - the thumbnails now appear.

Is there a way to get the thumbnails to show without first navigating to the folder in Windows Explorer?

Notes:

  1. Small PDFs actually seem to work OK, so test with PDFs larger than 1MB (we're dealing with multi-megabyte PDFs coming from scanners).
  2. This behavior occurs for Acrobat Reader, FoxIT and Sumatra PDF viewers.
  3. Graphic files like JPGs do not exhibit this behavior and work as expected.

Let me know if you need further details.

Comments (1)
DevExpress Support Team 5 years ago

    Hello Tom,

    I have reproduced this behavior with some PDF files. To my regret, we do not know why this happens and do not see an obvious solution yet. It may take us some time to examine this scenario.

    Answers approved by DevExpress Support

    created 5 years ago

    We researched this scenario, but couldn't find a way to change the existing behavior. In our control, we use Microsoft's https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ishellitemimagefactory interface to get thumbnails. We can display only those images that this interface provides.

    I realize that there should be a way to overcome this issue as Microsoft does it in their Explorer. We tried all combinations of flags for that interface, but the result was always the same - no "preview" thumbnail (see the attached example without our controls). Perhaps, they are using a non-official hack.

    I hope we will be able to find a general solution someday.

      Comments (2)

        Yes, I found the same thing regarding the IShellItemImageFactory interface introduced with Vista. It seems the older IExtractImage did automatically cache thumbnails when you requested an image but the newer interface does not. Reading through the docs on MSDN, there is an IThumbnailCache interface with a GetThumbnail() method that is meant to be used for getting thumbnails and caching them as well. From MSDN:

        *To cache a thumbnail, an application must first obtain an IShellItem that represents the item for which a thumbnail will be obtained, and then pass the IShellItem to a call to IThumbnailCache::GetThumbnail. If the flags parameter to IThumbnailCache::GetThumbnail includes the flag WTSEXTRACT, and the thumbnail is not already cached, a thumbnail will be extracted and placed in the cache. If the flag WTSFORCEEXTRACTION is set, the cache is ignored and a new thumbnail is always extracted. See the IThumbnailCache::GetThumbnail topic for more details on the flags passed to IThumbnailCache::GetThumbnail.

        If a thumbnail is not already in the cache, it will be automatically extracted from the source file using the existing implementation(s) of IExtractImage or IThumbnailProvider that is registered on the operating system. Your application does not have to provide an implementation of the thumbnail extractor.*

        I found the above from one of the answers here:
        [https://stackoverflow.com/questions/12654835/accessing-thumbnails-that-dont-exist]

        Thanks,
        Tom

        DevExpress Support Team 5 years ago

          Thanks, Tom. We have tested this approach. The result seems to be the same (see the attached example).

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.