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

VB2005 and webbrowser control
tamikn
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
hakito
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
TheCurse
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
CodeAnger
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
othman_11
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
LuisValencia
sweetnlowe
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
qsnet
Thanks for your answer
Patrick
ThomaWe
Are you sure about that Because on may version of VS2005, the currentViewMode property does not seems to exist !!
Thanks,
Patrick
Shawn Stern
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!!!
ShinjisukeSono