Results 1 to 6 of 6

Thread: Making the WebBrowser control show the desktop

  1. #1

    Thread Starter
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815

    Making the WebBrowser control show the desktop

    How could i make the WebBrowser control show the desktop, including the background and My Computer, the Recycle Bin and Network Neighbourhood???
    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

  2. #2
    Matthew Gates
    Guest
    Just to let you know, the desktop is just a folder.
    This will work:

    Code:
    WebBrowser1.Navigate "C:\Windows\Desktop"

  3. #3
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Matthew, wouldn't this code be better
    Code:
    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.

  4. #4
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    See this link for getting a snapahot of desktop
    http://forums.vbworld.com/showthread...threadid=74881

  5. #5
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    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!


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  6. #6
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width