Windows API
-
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...
-
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...
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!
-
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...
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
-
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
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...