質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
C#

C#はマルチパラダイムプログラミング言語の1つで、命令形・宣言型・関数型・ジェネリック型・コンポーネント指向・オブジェクティブ指向のプログラミング開発すべてに対応しています。

Q&A

1回答

4324閲覧

C#で.myjpgの拡張子で、WindowsのExplorerにサムネイルを出したいです。

cancat

総合スコア313

C#

C#はマルチパラダイムプログラミング言語の1つで、命令形・宣言型・関数型・ジェネリック型・コンポーネント指向・オブジェクティブ指向のプログラミング開発すべてに対応しています。

0グッド

0クリップ

投稿2017/02/22 04:49

こんにちは。
Windows10でC#のアプリケーションを開発しています。
Visual Studio 2015 Communityを使っています。

###前提・実現したいこと
オリジナルの画像ビューアを、オリジナルの拡張子(中はjpg)で操作し、WindowsのExplorerにサムネイルを出したいです。

###試したこと
画像の拡張子.jpgを.myjpgに書き換える。
アイコンのプロパティで、プログラムを変更し、自分のMyApplicationを拡張子に割り当てる。

###発生している問題・エラーメッセージ
Thumbnailを表示しない。

###補足情報(言語/FW/ツール等のバージョンなど)
Microsoft Visual Studio Community 2015
Version 14.0.25424.00 Update 3
Microsoft .NET Framework
Version 4.6.01038

インストールしているバージョン:Community

Visual C# 2015 00322-20000-00000-AA575
Microsoft Visual C# 2015

です。
よろしくお願いします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

.jpgに関するレジストリから以下をコピーし.jpg.myjpgに置き換えて登録すれば*.myjpgでサムネイル表示がされました。
HKCR.myjpg\shell\open\command の値は起動するプログラムを指定ください。
以下では"%ProgramFiles%\Windows NT\Accessories\WORDPAD.EXE" "%1"としています。

regist-myjpg.reg

Windows7で動作確認しましたので、もしかするとWindows10では以下のGUID値(CLASSID)が変更になってるかもしれません。(変更はされてないとは思いますがねんのため)
変更になってたらHKEY_CLASSES_ROOT\SystemFileAssociations\.jpg\ShellEx\を参照し.jpgのものをコピーしてください。

[HKEY_CLASSES_ROOT\SystemFileAssociations.myjpg\ShellEx{e357fccd-a995-4576-b01f-234630154e96}]
@="{C7657C4A-9F68-40fa-A4DF-96BC08EB3551}"

Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.myjpg] "Content Type"="image/jpeg" @="myjpg" [HKEY_CLASSES_ROOT\.myjpg\shell\open\command] @=hex(2):22,00,25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,\ 00,65,00,73,00,25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,\ 4e,00,54,00,5c,00,41,00,63,00,63,00,65,00,73,00,73,00,6f,00,72,00,69,00,65,\ 00,73,00,5c,00,57,00,4f,00,52,00,44,00,50,00,41,00,44,00,2e,00,45,00,58,00,\ 45,00,22,00,20,00,22,00,25,00,31,00,22,00,00,00 [HKEY_CLASSES_ROOT\SystemFileAssociations\.myjpg] "PreviewDetails"="prop:System.Photo.DateTaken;System.Keywords;*System.Photo.PeopleNames;System.Rating;*System.Image.Dimensions;*System.Size;System.Title;System.Author;System.Comment;*System.OfflineAvailability;*System.OfflineStatus;System.Photo.CameraManufacturer;System.Photo.CameraModel;System.Subject;*System.Photo.FNumber;*System.Photo.ExposureTime;*System.Photo.ISOSpeed;*System.Photo.ExposureBias;*System.Photo.FocalLength;*System.Photo.MaxAperture;*System.Photo.MeteringMode;*System.Photo.SubjectDistance;*System.Photo.Flash;*System.Photo.FlashEnergy;*System.Photo.FocalLengthInFilm;*System.DateCreated;*System.DateModified;*System.SharedWith" "FullDetails"="prop:System.PropGroup.Description;System.Title;System.Subject;System.Rating;System.Keywords;*System.Photo.PeopleNames;System.Comment;System.PropGroup.Origin;System.Author;System.Photo.DateTaken;System.ApplicationName;System.DateAcquired;System.Copyright;System.PropGroup.Image;System.Image.ImageID;System.Image.Dimensions;System.Image.HorizontalSize;System.Image.VerticalSize;System.Image.HorizontalResolution;System.Image.VerticalResolution;System.Image.BitDepth;System.Image.Compression;System.Image.ResolutionUnit;System.Image.ColorSpace;System.Image.CompressedBitsPerPixel;System.PropGroup.Camera;System.Photo.CameraManufacturer;System.Photo.CameraModel;System.Photo.FNumber;System.Photo.ExposureTime;System.Photo.ISOSpeed;System.Photo.ExposureBias;System.Photo.FocalLength;System.Photo.MaxAperture;System.Photo.MeteringMode;System.Photo.SubjectDistance;System.Photo.Flash;System.Photo.FlashEnergy;System.Photo.FocalLengthInFilm;System.PropGroup.PhotoAdvanced;System.Photo.LensManufacturer;System.Photo.LensModel;System.Photo.FlashManufacturer;System.Photo.FlashModel;System.Photo.CameraSerialNumber;System.Photo.Contrast;System.Photo.Brightness;System.Photo.LightSource;System.Photo.ExposureProgram;System.Photo.Saturation;System.Photo.Sharpness;System.Photo.WhiteBalance;System.Photo.PhotometricInterpretation;System.Photo.DigitalZoom;System.Photo.EXIFVersion;System.PropGroup.GPS;*System.GPS.Latitude;*System.GPS.Longitude;*System.GPS.Altitude;System.PropGroup.FileSystem;System.ItemNameDisplay;System.ItemType;System.ItemFolderPathDisplay;System.DateCreated;System.DateModified;System.Size;System.FileAttributes;System.OfflineAvailability;System.OfflineStatus;System.SharedWith;System.FileOwner;System.ComputerName" "InfoTip"="prop:System.ItemType;System.Photo.DateTaken;System.Keywords;*System.Photo.PeopleNames;System.Rating;*System.Image.Dimensions;*System.Size;System.Title" "ExtendedTileInfo"="prop:System.ItemType;System.Photo.DateTaken;*System.Image.Dimensions" "SetDefaultsFor"="prop:System.Author;System.Document.DateCreated;System.Photo.DateTaken" "ImageOptionFlags"=dword:00000001 [HKEY_CLASSES_ROOT\SystemFileAssociations\.myjpg\ShellEx] [HKEY_CLASSES_ROOT\SystemFileAssociations\.myjpg\ShellEx\{e357fccd-a995-4576-b01f-234630154e96}] @="{C7657C4A-9F68-40fa-A4DF-96BC08EB3551}"

shell拡張(Shell Extensions)を作成します。
Explorerの拡張モジュールを作成する形になります。

ここで書ききれる内容ではないのでこれらの参考情報を参照ください。

(social.msdn.microsoft.com/Forums/vstudio)サムネイルについて

Writing Windows Shell Extension with .NET 4 - Part 3

検索ワードとしては「Windows ShellExtention IExtractIcon IExtractImage」こんなところですかね。
基本的に日本語の情報は少ないです。また、.NETでの実装を説明しているものは極々少数です。

当然、作成したモジュールに不具合があればExplorer自体の動作に影響が出ます。

投稿2017/02/22 06:13

編集2017/02/22 08:59
Y.H.

総合スコア7914

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

cancat

2017/02/22 06:33

ありがとうございます。 なかみはjpgそのものなのですが、それでもシェル拡張の作成が必要なのでしょうか?
Y.H.

2017/02/22 08:32

とりあえずレジストリ登録だけで*.myjpgをサムネイル表示できる方法を回答に追記しました
cancat

2017/02/22 11:44

おおおお。すごいです。確認します。しばし。
Y.H.

2017/02/22 11:56

帰宅したので自宅のWindows10 Home Version 10.0.14986 で確認しましたが *.jpg同様に*.myjpgファイルで「詳細/一覧/小アイコン」以外でサムネイルが表示されました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問