PDA

Click to See Complete Forum and Search --> : Making the WebBrowser control show the desktop


Illspirit
May 12th, 2001, 08:41 AM
How could i make the WebBrowser control show the desktop, including the background and My Computer, the Recycle Bin and Network Neighbourhood???

Matthew Gates
May 12th, 2001, 01:36 PM
Just to let you know, the desktop is just a folder.
This will work:

WebBrowser1.Navigate "C:\Windows\Desktop"

amitabh
May 13th, 2001, 03:18 PM
Matthew, wouldn't this code be better

Const CSIDL_DESKTOP = &H0
Const CSIDL_TEMPLATES = &H15
Const MAX_PATH = 260

Private Type EMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As EMID
End Type

Private Declare Function ShellAbout Lib "shell32.dll" _
Alias "ShellAboutA" (ByVal hWnd As Long, ByVal szApp As String, _
ByVal szOtherStuff As String, ByVal hIcon As Long) As Long

Private Declare Function SHGetSpecialFolderLocation Lib _
"shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl _
As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As _
String) As Long

Dim strDesktopPath as string

Private Sub Form_Load()
strDesktopPath = GetSpecialfolder(CSIDL_DESKTOP)
WebBrowser1.Navigate2 strDesktopPath
End Sub
Private Function GetSpecialfolder(CSIDL As Long) As String
Dim r As Long
Dim IDL As ITEMIDLIST
'Get the special folder
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = 0 Then
'Create a buffer
Path$ = Space$(512)
'Get the path from the IDList
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
'Remove the unnecessary chr$(0)'s
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function

Anyway, this will show you only the folders content. To show all the background picutre, you will have to take a snapshot of the desktop.

amitabh
May 13th, 2001, 03:21 PM
See this link for getting a snapahot of desktop
http://forums.vbworld.com/showthread.php?s=&threadid=74881

Microbasic
May 13th, 2001, 05:03 PM
I amswered his question on the Generals Forum and he said that he wants a COMPLETELY FUNCTIONAL DESKTOP WITH MY COMPUTER, NETWORK, etc. Those are not in C:\windows\desktop\.

All you have to do is move the desktop from "#32769" to your form using SetParent. DANGEROUS!

amitabh
May 13th, 2001, 09:54 PM
I don't think windows wuld allow this. Desktop is said to the parent window of all window in the system. So I don't think it will allow you to set itself as a child window