Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Article Writing
  4. How to set thumbnail image to a file icon of Explorer

How to set thumbnail image to a file icon of Explorer

Scheduled Pinned Locked Moved Article Writing
adobetutorialcomlounge
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Masahiro Kurosawa
    wrote on last edited by
    #1

    Some image viewer application programs, for example, Adobe Photoshop(http://www.adobe.com/) or SolidWorks(http://www.solidworks.com) set thumbnail image of a file to its file icon in Explorer so that the users can know the content of the image file without opening it. (I do not imply "Thumbnail View" when Explorer is at "Web Page" mode, but customized icon only for a file in place of the application's general file icon.) I want to do same thing above in my application program. If anybody know how to set thumbnail image (custamized icon) to a file icon in place of the application's general file icon in Explorer, please tell me. ------------------------------- Masahiro Kurosawa kurosaw@itg.hitachi.co.jp -------------------------------

    PJ ArendsP M 2 Replies Last reply
    0
    • M Masahiro Kurosawa

      Some image viewer application programs, for example, Adobe Photoshop(http://www.adobe.com/) or SolidWorks(http://www.solidworks.com) set thumbnail image of a file to its file icon in Explorer so that the users can know the content of the image file without opening it. (I do not imply "Thumbnail View" when Explorer is at "Web Page" mode, but customized icon only for a file in place of the application's general file icon.) I want to do same thing above in my application program. If anybody know how to set thumbnail image (custamized icon) to a file icon in place of the application's general file icon in Explorer, please tell me. ------------------------------- Masahiro Kurosawa kurosaw@itg.hitachi.co.jp -------------------------------

      PJ ArendsP Offline
      PJ ArendsP Offline
      PJ Arends
      wrote on last edited by
      #2

      Have a look at the IconPro sample included on the MSDN CD

      Within you lies the power for good; Use it!

      1 Reply Last reply
      0
      • M Masahiro Kurosawa

        Some image viewer application programs, for example, Adobe Photoshop(http://www.adobe.com/) or SolidWorks(http://www.solidworks.com) set thumbnail image of a file to its file icon in Explorer so that the users can know the content of the image file without opening it. (I do not imply "Thumbnail View" when Explorer is at "Web Page" mode, but customized icon only for a file in place of the application's general file icon.) I want to do same thing above in my application program. If anybody know how to set thumbnail image (custamized icon) to a file icon in place of the application's general file icon in Explorer, please tell me. ------------------------------- Masahiro Kurosawa kurosaw@itg.hitachi.co.jp -------------------------------

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        Check out my shell extension article on this subject. --Mike-- http://home.inreach.com/mdunn/ The preferred snack of 4 out of 5 Lounge readers.

        M 2 Replies Last reply
        0
        • M Michael Dunn

          Check out my shell extension article on this subject. --Mike-- http://home.inreach.com/mdunn/ The preferred snack of 4 out of 5 Lounge readers.

          M Offline
          M Offline
          Masahiro Kurosawa
          wrote on last edited by
          #4

          Thank you for your reply. I think that's what I want to know. I'm going to see the recommended article in detail. :) ------------------------------- Masahiro Kurosawa kurosaw@itg.hitachi.co.jp -------------------------------

          1 Reply Last reply
          0
          • M Michael Dunn

            Check out my shell extension article on this subject. --Mike-- http://home.inreach.com/mdunn/ The preferred snack of 4 out of 5 Lounge readers.

            M Offline
            M Offline
            Masahiro Kurosawa
            wrote on last edited by
            #5

            At first, I greatly appreciate your advice. I can understand how to customize the icons and icon handler architecture. Well, I have another question: - - - How to retrieve a handle to an icon from the specified file as we can do same thing from DLL or EXE using 'ExtractIcon' function ? - - - I'm sorry to trouble you so often. If you can find time for me, please tell me the solution about this. ------------------------------- Masahiro Kurosawa kurosaw@itg.hitachi.co.jp -------------------------------

            M 1 Reply Last reply
            0
            • M Masahiro Kurosawa

              At first, I greatly appreciate your advice. I can understand how to customize the icons and icon handler architecture. Well, I have another question: - - - How to retrieve a handle to an icon from the specified file as we can do same thing from DLL or EXE using 'ExtractIcon' function ? - - - I'm sorry to trouble you so often. If you can find time for me, please tell me the solution about this. ------------------------------- Masahiro Kurosawa kurosaw@itg.hitachi.co.jp -------------------------------

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #6

              How to retrieve a handle to an icon from the specified file as we can do same thing from DLL or EXE using 'ExtractIcon' function? Sorry, I don't quite understand what you're asking. Is ExtractIcon not working? --Mike-- http://home.inreach.com/mdunn/ The preferred snack of 4 out of 5 Lounge readers.

              M 1 Reply Last reply
              0
              • M Michael Dunn

                How to retrieve a handle to an icon from the specified file as we can do same thing from DLL or EXE using 'ExtractIcon' function? Sorry, I don't quite understand what you're asking. Is ExtractIcon not working? --Mike-- http://home.inreach.com/mdunn/ The preferred snack of 4 out of 5 Lounge readers.

                M Offline
                M Offline
                Masahiro Kurosawa
                wrote on last edited by
                #7

                Oh, I apologize to you if my description was not enough. At first, Visual C++ 6.0 Help reads that ExtractIcon function retrieves a handle to an icon from the specified executable file, dynamic-link library (DLL), or icon file. Then, I actually try to use ExtractIcon function for text file (.txt), but ExtractIcon would not work as Help reads. If there is a way to retrieve a handle to an icon from '.EXE', '.DLL', or '.ICO', I think there is also a way to do same from '.TXT'. Should I use IExtractIcon interface like Explorer? If so, I want to know how to use IExtractIcon interface ( I understand how to implement IExtractIcon interface for Explorer to use thanks to you ). Or, If there is more easier way like using ExtractIcon for '.EXE', '.DLL', or '.ICO, please instruct me. ------------------------------- Masahiro Kurosawa kurosaw@itg.hitachi.co.jp -------------------------------

                M 1 Reply Last reply
                0
                • M Masahiro Kurosawa

                  Oh, I apologize to you if my description was not enough. At first, Visual C++ 6.0 Help reads that ExtractIcon function retrieves a handle to an icon from the specified executable file, dynamic-link library (DLL), or icon file. Then, I actually try to use ExtractIcon function for text file (.txt), but ExtractIcon would not work as Help reads. If there is a way to retrieve a handle to an icon from '.EXE', '.DLL', or '.ICO', I think there is also a way to do same from '.TXT'. Should I use IExtractIcon interface like Explorer? If so, I want to know how to use IExtractIcon interface ( I understand how to implement IExtractIcon interface for Explorer to use thanks to you ). Or, If there is more easier way like using ExtractIcon for '.EXE', '.DLL', or '.ICO, please instruct me. ------------------------------- Masahiro Kurosawa kurosaw@itg.hitachi.co.jp -------------------------------

                  M Offline
                  M Offline
                  Michael Dunn
                  wrote on last edited by
                  #8

                  Ah ok, you want to get the icon that's used for TXT files, right? The way to do that is with SHGetFileInfo(), such as:

                  SHFILEINFO info;

                  SHGetFileInfo ( _T("foo.txt"), FILE_ATTRIBUTE_NORMAL, &info, sizeof(SHFILEINFO),
                  SHGFI_ICON | SHGFI_USEFILEATTRIBUTES );

                  After that, info.hIcon is the icon. Add SHGFI_SMALLICON to the flags if you want the small (16x16) icon. --Mike-- http://home.inreach.com/mdunn/ The preferred snack of 4 out of 5 Lounge readers.

                  M 1 Reply Last reply
                  0
                  • M Michael Dunn

                    Ah ok, you want to get the icon that's used for TXT files, right? The way to do that is with SHGetFileInfo(), such as:

                    SHFILEINFO info;

                    SHGetFileInfo ( _T("foo.txt"), FILE_ATTRIBUTE_NORMAL, &info, sizeof(SHFILEINFO),
                    SHGFI_ICON | SHGFI_USEFILEATTRIBUTES );

                    After that, info.hIcon is the icon. Add SHGFI_SMALLICON to the flags if you want the small (16x16) icon. --Mike-- http://home.inreach.com/mdunn/ The preferred snack of 4 out of 5 Lounge readers.

                    M Offline
                    M Offline
                    Masahiro Kurosawa
                    wrote on last edited by
                    #9

                    Yes, that's what I want to do. Thank you very much. Also, I'm coming to understand where I should refer in VC++ Help thanks to your advices, so I wish to express my appreciation to you again. Thanks a lot. Sincerely yours ------------------------------- Masahiro Kurosawa kurosaw@itg.hitachi.co.jp -------------------------------

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups