sharpshell
sharpshell copied to clipboard
AssociationType.FileExtension deprecated, but AssociationType.ClassOfExtension not working
Version of SharpShell used: 2.7.1
Related type(s) of SharpShell-Server: SharpThumbnailHandler
Thanks a lot for this helpful library in advance!
I just made a very simple thumbnail handler for a custom file type, using AssociationType.ClassOfExtension
. It worked fine until I registered the program as default application for this file type. Afterwards, only the application icon was shown. The logs of SharpShell indicated that the thumbnail server was never called again. Deregistering the default program made the thumbnails visible again.
Then I switched to AssociationType.FileExtension
, as indicated on https://github.com/dwmkerr/sharpshell/blob/master/docs/troubleshooting.md. Using this, everything worked fine. However, AssociationType.FileExtension
is marked as deprecated.
Could anyone clear this up for me?
Hey jhofinger,
Great to hear you're liking SharpShell so far. I'd like to try help / clear this issue.
Quick question: What OS do you use? Windows 10? I tried to reproduce it by
- creating a new SharpThumbnailHandler that just returns 1 static bitmap file
- registered
AssociationType.ClassOfExtension
for ".c0p" (works, shows new img) - changed the default program for ".c0p"
- no problem - still shows the correct img AND a little icon on in the lower right corner (see image)
So I could not reproduce the problem neither do I know, what could cause the issue. Maybe some caching problem? It's hard to tell windows/explorer to "Refresh".
Different OS / programs / systems might behave differently but I'd like to reproduce the issue. I also read about using "class of files" here: https://code.msdn.microsoft.com/windowsapps/CppShellExtThumbnailHandler-32399b35
Can you provide more information, such as
- share images
- what program do you set as default application for the file type?
- how do you set the default application
As a side note:
Previously, I thought you could only define a "default program" by setting
HKCR\<FileExtension>\Shell\Open\Command
.
But using the right click context cenu "Open as..." seems to instead set entries here:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\...
Hey Countryen, Thanks for your response. OS: Windows 10 Build 17763
The issue can be reproduced on my system as following:
- Write a SharpThumbnailHandler for a custom file extension using
ClassOfExtension
- Install and Register the handler using the Server Manager -> Thumbnails are shown
- Register the file extension. Doesn't matter if set using Visual Studio Setup Project or using Right click -> Open with -> Set default program. In both cases, the image matches the one you posted, so Thumbnail + Icon in the bottom corner
- Create a new file with the extension. For this new file, only the icon (no thumbnail) is shown.
If the ThumbnailHandler uses FileExtension
instead, the thumbnail is still visible after the last step. The behavior is consistent for different file types and persists after re-registering the thumbnail handler.
I hope you're able to reproduce the issue.
Hey there, sorry that I didn't update yet - did try it and now I can reproduce it. New files are not displayed correctly. But I don't have a solution.
I guess you should use the FileExtension
then.
The Obsolete-marking should be checked.
It's obsolete because of discussions in issue #229
I think the devs need to change the logic so that it's not "obsolete" to use for SharpThumbnailHandler.
In most cases it's better to use the ClassOfExtension
but not in this one, I guess.