From: David C. Holley on
When an iFrame is being used to display the contents of a folder on a
machine, is it possible to use VBScript to change the view of the folder?
I've got a iFrame whose source is changed via VBScript, but when it changes
the folder shows Icons. I'd rather view the folder Details instead.


From: mayayana on
I don't know for sure, but I don't know of any
way to access that setting in an open window.
As personal settings they're not designed to be
changeable by software. (Actually they're not very
well designed to be changed by persons, either,
but that's another story. :)

Once you navigate to a folder you've actually
got an Explorer window. The view there is a
ShellFolderView. The SFV can be accessed as
the Document object of the IE instance. (In
pre-XP folder views were actually a webpage with
a ListView control on them, and each folder had
an embedded IE window. Since XP there is actually
no connection between IE and folder windows. The
"Active Desktop/WebView" stuff was removed. But
the object model was maintained for compatibility.
So SFW still gives you the folder view object, each
folder is still returned as a (dummy) IE instance,
and the IE Document is the SFV.)

SFV doesn't have any properties or methods to set
the view mode. It may be possible via the various Shell
interfaces, but I don't know of any method via SFV
or the IE object.

A few interesting bits that may or may not be useful
in your search:

Different versions of Windows have various ways
to store the view settings in the Registry. There's
a "Mode" value with a corresponding "Vid" value to
designate the view type.
Setting those values beforehand will set the folder
view for a specific folder, but it's a tedious job that's
different on different Windows versions, and the whole
system is half-broken.

If you're dealing with XP
you could change the setting in the Registry prior to
opening a folder. That might be realistic. I don't think
it works on Vista/7. And it won't work for a currently-open
folder. And it means that you'd be editing personal settings,
so you'd need to also track your changes and change
them back when you're done.

The Vid value is a "ViewID" GUID string. In VB6, a
WebBrowser control (which is just an IE window) has a
hidden ViewID property set to the GUID for icons.

So there are various things that point to this ViewID.
But I haven't found any actual documentation of exactly
where ViewID comes from or where it's used. It may just
be an undocumented value used internally by Explorer.exe.

If the Registry approach is useful to you see the Folder
Fix downloads here for code and explanations:

http://www.jsware.net/jsware/xpfix.php5



> When an iFrame is being used to display the contents of a folder on a
> machine, is it possible to use VBScript to change the view of the folder?
> I've got a iFrame whose source is changed via VBScript, but when it
changes
> the folder shows Icons. I'd rather view the folder Details instead.
>
>


From: mr_unreliable on
David C. Holley wrote:
> When an iFrame is being used to display the contents of a folder on a
> machine, is it possible to use VBScript to change the view of the folder?
> I've got a iFrame whose source is changed via VBScript, but when it changes
> the folder shows Icons. I'd rather view the folder Details instead.
>

hi David,

If you are willing to "go-beyond-the-pale" of conventional
scripting and indulge in calling the system api's, then
there is a way. Or, at least a way for older systems.

Go to Brad Martinez' code entitled "Extending the functionality
of the VB ListView controls" found here:

http://btmtz.mvps.org/listview/

On that page you will find several demo programs. The one
of interest for changing the "view" of the listview control
is the demo entitled: "setshellview1" near the bottom of
the page. Martinez changes the view by doing two things.
He sends a wm_command to the control, with one of the
following constants:

Public Const IDM_SHVIEW_LARGEICON = &H7029 ' 28713
Public Const IDM_SHVIEW_SMALLICON = &H702A ' 28714
Public Const IDM_SHVIEW_LIST = &H702B ' 28715
Public Const IDM_SHVIEW_REPORT = &H702C ' 28716

And also, he fiddles with the control's style bits:

Public Enum LVViews
LVS_ICON = &H0
LVS_REPORT = &H1
LVS_SMALLICON = &H2
LVS_LIST = &H3
End Enum

If you happen to have a vb5/6 compiler handy, you can test
Martinez' code on your system. Or, you could wrap Martinez'
code into an actX object, and use it that way. Or, if you
are courageous enough or foolhardy enough to call the system
api's from script, you could just use the Martinez approach
directly.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)

From: mr_unreliable on
mr_unreliable wrote:
> If you are willing to "go-beyond-the-pale" of conventional
> scripting and indulge in calling the system api's, then
> there is a way. Or, at least a way for older systems.
>
You may also wish to read "Enabling Visual Styles",
found here:

http://msdn.microsoft.com/en-us/library/ms649781(VS.85).aspx

cheers, jw
From: mr_unreliable on
David C. Holley wrote:
> When an iFrame is being used to display the contents of a folder on a
> machine, is it possible to use VBScript to change the view of the folder?
> I've got a iFrame whose source is changed via VBScript, but when it changes
> the folder shows Icons. I'd rather view the folder Details instead.
>
>

For a more up-to-date treatment, start with the
FOLDERVIEWMODE enumerated constants:

typedef enum FOLDERVIEWMODE {
FVM_AUTO = -1,
FVM_FIRST = 1,
FVM_ICON = 1,
FVM_SMALLICON = 2,
FVM_LIST = 3,
FVM_DETAILS = 4,
FVM_THUMBNAIL = 5,
FVM_TILE = 6,
FVM_THUMBSTRIP = 7,
FVM_CONTENT = 8,
FVM_LAST = 8
} FOLDERVIEWMODE;

http://msdn.microsoft.com/en-us/library/bb762510(VS.85).aspx

The FOLDERVIEWMODE constants are used in the
FOLDERSETTINGS Structure, found here:

http://msdn.microsoft.com/en-us/library/bb773308(VS.85).aspx

The FOLDERSETTINGS Structure appears in the
IShellView::CreateViewWindow Method:

http://msdn.microsoft.com/en-us/library/bb774827(VS.85).aspx

Note that there is _NO_ "IShellView::SetCurrentInfo Method"
which implies that you destroy and then re-create the
window, if you wish to change the view(?)...

The above methods are parts of the "IShellView Interface"
found here:

http://msdn.microsoft.com/en-us/library/bb774834(VS.85).aspx

See "SHCreateShellFolderView Function", found here:

http://msdn.microsoft.com/en-us/library/bb762141(VS.85).aspx

And that (CreateShellFolderView) was found among those mysterious
"secret" (a.k.a. "hidden") interfaces, which ms reluctantly
divulged after being sued by some other developers, who claimed
that ms wasn't "playing fair" by not revealing all the systems
interfaces ms was using in it's own development efforts.
A complete listing of the ms interfaces (so-called "Settlement
Program Interfaces") can be found here:

http://msdn.microsoft.com/en-us/library/ms807073.aspx

cheers, jw