VB2005 and webbrowser control

Hi,
I am trying to use the webbrowser control as a list view for viewing files on the disque. My main purpose is to use build-in fonctionnalities like thumnails view withaout having to write code (reinvent the wheel).
It works great but I don't know how to programatically control the way the browser display files. I mean, how to control the "view" property (list, details, thumnails, etc) of the web browser.
I also would like to remove that menu pannel on the left.
Can anyone help me ?
Thanks,
Patrick
[531 byte] By [Emphyrio] at [2008-2-22]
# 1
Really nobody has an idea on how to control the way webbrowser control display file ?
Emphyrio at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 2
<quote> I mean, how to control the "view" property (list, details, thumnails, etc) of the web browser.</quote>

It is done through the document class...ie display a HTML document with a table some details and pics....and even some web UI controls!!!
DMan1 at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 3
Hum... I am not sure of that.
Just add a WebBrowser control in a form, and set the url to c:\
You get a "big icons" view of the root of your C: drive. I don't think this is a html document...
I want to be able to programmatically change the display property (list, details, thumnails, etc.) as you can manually do in the right mouse button context menu.

Do you have an idea ?

Emphyrio at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 4
I do know if the webbrowser supports this however you could just use the ListView control to provide this functionality.
cmccoll_MS at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 5
I know, but the ListeView control does not implement a Thumbnail View.
I know how to generate thumbnails in VB but it would be too long for directories with a lot of picture. It would be recalcutated everytime you change directory. I like the way Windows Explorer does that by using a Tumb.db file
Maybe I could rewrite something similar, but I do not want to "reinvent the wheel". Windows can do that, why not using it ?
Patrick
Emphyrio at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 6
Hi!
I had the same problem so evetually I put a watch on the WebBrowser and was lucky and discovered a solution.

My solution is:

myWebBrowser.document.currentViewMode = 5

I tried some different numbers...
4 = list
5 = thumbnails
6 = summary
7 = slideshow
...

It works for me
Hope you find it useful!

/Alex

lx_aka_alex at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 7
Hi,

Are you sure about that ? Because on may version of VS2005, the currentViewMode property does not seems to exist !!

Thanks,
Patrick

Emphyrio at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 8

Thank you for confirming. 5 works.. This doesnt seem well documented.

Is there a way to turn off that windows xp pane on the left for links/details/tasks?
Would also be nice to handle an Event in VB as you click on thumbnails in explorer, and retrieve folderitem to synchronize with another update text control

just an update:
I did find an interesting custom web view article on using a hypertext template
http://msdn.microsoft.com/msdnmag/issues/0600/w2kui2/
but it sounds like that needs a desktop.ini and .htt file relative to each directory, yuck .

- joe

JoeB at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 9
Actually, the document property of the webbrowser object does not have a currentViewMode property. At least in VS 2005.
So I can not try your suggestion.
Are you using VS2005 or 2003 ?
If I am right, VS2003 does not even have a webbrowser control.
How can you use that property ?

Thanks
Patrick

Emphyrio at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 10

I'm using the vb editor in Access, rather than trying to access through the properties for the control. The only way to see the properites available was through the Debugger Watch on the object for the shellview (oDoc in my sample below)

Private Sub DisplayThumbs()
Dim sPath As String
If Not IsNull(Me![ScanPath]) Then
' do special folder string replacement for mydocuments
sPath = ReplaceSpecialPath(Me![ScanPath])

Set oDoc = WebBrowser.Document
If (Not oDoc Is Nothing) Then
Set oFolder = oDoc.Folder
Set oFolderItem = oFolder.Self
If (Not oFolderItem Is Nothing) Then
lPath = oFolderItem.path
End If
End If

If (lPath <> sPath) Then
WebBrowser.Navigate2 (sPath)
End If

' may need to wait a until valid doc
If WebBrowser.ReadyState <> 4 Then
DoEvents
End If
Set oDoc = WebBrowser.Document
If (Not oDoc Is Nothing) Then
' set view style to thumbs
oDoc.CurrentViewMode = 5
End If
WebBrowser.Visible = True
Else
' if not valid path just clear browser
WebBrowser.Navigate2 ("about:blank")
End If
End Sub

By the way, I was able to to find a way to see if thumbnail was clicked on and focus changed using the "StatusTextChange" event. I'm still toying with this, but this sorta will work ("WebBrowser" is my control name)

Private Sub WebBrowser_StatusTextChange(ByVal sText As String)
If (sText <> lStatusText) Then
SelectFocusedFile
lStatusText = sText

End If

End Sub

Private Sub SelectFocusedFile()
Set oDoc = WebBrowser.Document
If (Not oDoc Is Nothing) Then
Set oItem = oDoc.FocusedItem
If oItem.Name <> lFileName Then
UpdatePriorImage
lFileName = oItem.Name
SelectNewImage oItem.Name
End If
End If
End Sub

I'm not familiar with whats available in .net, but maybe this could be used?
Hope it helps
-Joe

JoeB at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 11
I think that the WebControls in Access and VB 2005 are not the same at all, because in my WebControl, the document property does not have the properties you are speaking about (CurrentViewMode) and I can not find an appropriate property to do the same thing.

Thanks for your answer
Patrick

Emphyrio at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic IDE...