I'm programmatically creating a folder using C# and need to se开发者_如何学运维t the default view of the folder to "Thumbnails".
The relevant registry keys are listed here: http://support.microsoft.com/kb/812003
However, "Remember each folder's view settings" would need to be selected in order for changes in that KB article to take effect. It seems like it would be 'bad behavior' for a program to change this without specific user prompting.
Update: For the desktop.ini, I've never had much luck using it; however, this site seems to list a few CLSIDs that may be worth looking into: http://www.xs4all.nl/~hwiegman/desktopini.html
Specifically the [ExtShellFolderViews] section. I gave it a whirl but didn't have any luck.
The only way I know to manipulate this setting is through pInvoke, but it looks like there is no message to set the view to Thumbnails. Here is a code snippet targeted to WinXP.
Assuming you do this yourself using a ListView
, you can either set the View
property to LargeIcon
or if that's not enough (you mention Thumbnails) you should probably set OwnerDraw
to true for the items and draw them yourself.
Call IFolderView::SetCurrentViewMode with FVM_THUMBSTRIP
Not sure which explorer window you should query IFolderView from though. There could be multiple explorer windows on the user's desktop, those running under a higher integrity level would deny you access if you are from a lower integrity level.
According to this post you can make a reference to shdocvw.dll to query the current IServiceProvider
.Then get theIShellBrowser
--> IShellView
--> IFolderView
. When you have IFolderView
you can get/set the current view mode of the folder.
精彩评论