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. The Lounge
  3. Windows API

Windows API

Scheduled Pinned Locked Moved The Lounge
algorithmsjsonquestion
4 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.
  • P Offline
    P Offline
    PaulowniaK
    wrote on last edited by
    #1

    Apologies if I'm being stupidly blind but I couldn't find an exact place to post this so here it is... Any suggestions on where to move it welcome. I want to know more about what Windows 7 is doing with the file properties. So it detects a file that is a picture and shows a thumbnail instead of an icon (provided you've told it to and are showing the right level of complexity of Windows Explorer). It also shows you the picture in the preview window. If you then select a text file, say, it will give you the content of the text file in the preview. So how is this all controlled? I got as far as getting hold of the Windows API Code Pack 1.1 but am struggling to find out how exactly to use it to achieve my goals. Any info or tips greatly appreciated!

    Almost, but not quite, entirely unlike... me...

    A G 2 Replies Last reply
    0
    • P PaulowniaK

      Apologies if I'm being stupidly blind but I couldn't find an exact place to post this so here it is... Any suggestions on where to move it welcome. I want to know more about what Windows 7 is doing with the file properties. So it detects a file that is a picture and shows a thumbnail instead of an icon (provided you've told it to and are showing the right level of complexity of Windows Explorer). It also shows you the picture in the preview window. If you then select a text file, say, it will give you the content of the text file in the preview. So how is this all controlled? I got as far as getting hold of the Windows API Code Pack 1.1 but am struggling to find out how exactly to use it to achieve my goals. Any info or tips greatly appreciated!

      Almost, but not quite, entirely unlike... me...

      A Offline
      A Offline
      AlexCode
      wrote on last edited by
      #2

      What exactly are your goals? I imagine that they showld be adding new file extensions right? As far as I know this is all controlled by Registry configurations. HAve a look here: http://superuser.com/questions/91804/windows-7-preview-other-file-types-as-text-in-preview-pane[^] Cheers!

      1 Reply Last reply
      0
      • P PaulowniaK

        Apologies if I'm being stupidly blind but I couldn't find an exact place to post this so here it is... Any suggestions on where to move it welcome. I want to know more about what Windows 7 is doing with the file properties. So it detects a file that is a picture and shows a thumbnail instead of an icon (provided you've told it to and are showing the right level of complexity of Windows Explorer). It also shows you the picture in the preview window. If you then select a text file, say, it will give you the content of the text file in the preview. So how is this all controlled? I got as far as getting hold of the Windows API Code Pack 1.1 but am struggling to find out how exactly to use it to achieve my goals. Any info or tips greatly appreciated!

        Almost, but not quite, entirely unlike... me...

        G Offline
        G Offline
        GenJerDan
        wrote on last edited by
        #3

        You'll be wanting Preview Handlers. Start here and investigate further: http://previewhandlers.codeplex.com/[^] But if all you want is the thumbnail of an image, you can do it more easily using a ShellObject, kinda sorta like this:

        private void UpdateThumbPreview(string Filename)
        {
        ShellObject currentItem = ShellObject.FromParsingName(Filename);
        if (currentItem != null)
        {
        if (currentMode == Mode.ThumbnailOrIcon)
        currentItem.Thumbnail.FormatOption = ShellThumbnailFormatOption.Default;
        else if (currentMode == Mode.ThumbnailOnly)
        currentItem.Thumbnail.FormatOption = ShellThumbnailFormatOption.ThumbnailOnly;
        else
        currentItem.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
        try
        {
        if (currentView == Views.Small)
        imgThumb.BackgroundImage = currentItem.Thumbnail.SmallBitmap;
        else if (currentView == Views.Medium)
        imgThumb.BackgroundImage = currentItem.Thumbnail.MediumBitmap;
        else if (currentView == Views.Large)
        imgThumb.BackgroundImage = currentItem.Thumbnail.LargeBitmap;
        else if (currentView == Views.ExtraLarge)
        imgThumb.BackgroundImage = currentItem.Thumbnail.ExtraLargeBitmap;
        }
        catch (NotSupportedException)
        {
        }
        catch (InvalidOperationException)
        {
        if (currentMode == Mode.ThumbnailOnly)
        {
        if (onErrorChangeMode)
        {
        UpdateThumbPreview(Filename);
        }
        else // else, ignore and display nothing.
        imgThumb.BackgroundImage = null;
        }
        else
        imgThumb.BackgroundImage = null;
        }
        }
        else
        imgThumb.BackgroundImage = null;
        }

        And now we're both in trouble for breaking the rules. ;P

        No dogs or cats are in the classroom. My

        P 1 Reply Last reply
        0
        • G GenJerDan

          You'll be wanting Preview Handlers. Start here and investigate further: http://previewhandlers.codeplex.com/[^] But if all you want is the thumbnail of an image, you can do it more easily using a ShellObject, kinda sorta like this:

          private void UpdateThumbPreview(string Filename)
          {
          ShellObject currentItem = ShellObject.FromParsingName(Filename);
          if (currentItem != null)
          {
          if (currentMode == Mode.ThumbnailOrIcon)
          currentItem.Thumbnail.FormatOption = ShellThumbnailFormatOption.Default;
          else if (currentMode == Mode.ThumbnailOnly)
          currentItem.Thumbnail.FormatOption = ShellThumbnailFormatOption.ThumbnailOnly;
          else
          currentItem.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
          try
          {
          if (currentView == Views.Small)
          imgThumb.BackgroundImage = currentItem.Thumbnail.SmallBitmap;
          else if (currentView == Views.Medium)
          imgThumb.BackgroundImage = currentItem.Thumbnail.MediumBitmap;
          else if (currentView == Views.Large)
          imgThumb.BackgroundImage = currentItem.Thumbnail.LargeBitmap;
          else if (currentView == Views.ExtraLarge)
          imgThumb.BackgroundImage = currentItem.Thumbnail.ExtraLargeBitmap;
          }
          catch (NotSupportedException)
          {
          }
          catch (InvalidOperationException)
          {
          if (currentMode == Mode.ThumbnailOnly)
          {
          if (onErrorChangeMode)
          {
          UpdateThumbPreview(Filename);
          }
          else // else, ignore and display nothing.
          imgThumb.BackgroundImage = null;
          }
          else
          imgThumb.BackgroundImage = null;
          }
          }
          else
          imgThumb.BackgroundImage = null;
          }

          And now we're both in trouble for breaking the rules. ;P

          No dogs or cats are in the classroom. My

          P Offline
          P Offline
          PaulowniaK
          wrote on last edited by
          #4

          Cool! :cool: Thanks, I'll give it a go.

          GenJerDan wrote:

          And now we're both in trouble for breaking the rules. ;-P

          Heh heh. Will be a good citizen and post any further queries in the programming forums. Promise ;)

          Almost, but not quite, entirely unlike... me...

          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