Results 1 to 7 of 7

Thread: Open My Computer through code

  1. #1
    Guest
    I am trying to open the My Computer folder (you know, the one with all the drives etc) from my VB app. I have a feeling this is done using the special folder values, or a command line switch to explorer. Can anyone point me in the right place to find the values etc? I will also need to be able to open network neighborhood and other special folders as well.

    Thanks!!!!

    Dan

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Shell "rundll32.exe shell32.dll,Control_RunDLL", vbNormalFocus
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest
    Well ... close. That launches Control Panel for me. What about My Computer and Network Neighborhood? Or do you know a website that documents the different commmands?

    Thanks!!!

    Dan

  4. #4
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    just open a new ie window and make it goto "My Computer"
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  5. #5
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    adn the rest are Control Panel, Recycle Bin, Network Neighborhood(sp?)
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    'you can get launch MyNeighbourhood Network with this
    '
    'use Sub Main as startup
    
    
    
    Public Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal pv As Long) 
    
    Public Declare Function SHBrowseForFolder Lib "shell32.dll" _ 
       Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long 
    
    'Converts an item identifier list to a file system path. 
    Public Declare Function SHGetPathFromIDList Lib "shell32.dll" _ 
       Alias "SHGetPathFromIDListA" _ 
      (ByVal pidl As Long, _ 
       ByVal pszPath As String) As Long 
    
    
    'parameters for SHBrowseForFolder 
    Public Type BROWSEINFO    'BI 
        hOwner As Long 
        pidlRoot As Long 
        pszDisplayName As String 
        lpszTitle As String 
        ulFlags As Long 
        lpfn As Long 
        lParam As Long 
        iImage As Long 
    End Type 
    
    Public Const CSIDL_NETWORK = &H12                  'Network Neighborhood 
    Public Const MAX_PATH = 260 
    
    
    Public Sub Main() 
    
    Dim BIF_FLAGS As Long 
    Dim sTitle As String 
    Dim lReturn 
        
    lReturn = Browse(BIF_FLAGS, "Network Neighborhood") 
        
        
    End Sub 
    
    
    
    Private Function Browse(BIF_FLAGS As Long, sTitle As String) As String 
    
      Dim pidl As Long 
      Dim BI As BROWSEINFO 
      Dim sPath As String 
      Dim pos As Integer 
       
       With BI 
          .hOwner = hWnd 
          .pidlRoot = CSIDL_NETWORK 
          .lpszTitle = "Browsing " & sTitle 
          .ulFlags = BIF_FLAGS 
          .pszDisplayName = Space$(MAX_PATH) 
       End With 
       
       pidl = SHBrowseForFolder(BI) 
       sPath = Space$(MAX_PATH) 
         
       If SHGetPathFromIDList(ByVal pidl, ByVal sPath) Then 
        
          pos = InStr(sPath, Chr$(0)) 
          If pos Then Browse = Left(sPath, pos - 1) 
        
       Else: Browse = "" 
             Text3 = "" 
       End If 
    
       pos = InStr(BI.pszDisplayName, Chr$(0)) 
       If pos Then Text3 = Left(BI.pszDisplayName, pos - 1) 
    
       Call CoTaskMemFree(pidl) 
             
    End Function
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  7. #7
    Addicted Member Stephenb's Avatar
    Join Date
    Nov 2000
    Location
    Phoenix, Arizona.
    Posts
    172

    Cool

    Try this.

    code
    Code:
    Public Enum ShellSpecialFolderConstants
        ssfDESKTOP = &H0
        ssfPROGRAMS = &H2
        ssfCONTROLS = &H3
        ssfPRINTERS = &H4
        ssfPERSONAL = &H5
        ssfFAVORITES = &H6
        ssfSTARTUP = &H7
        ssfRECENT = &H8
        ssfSENDTO = &H9
        ssfBITBUCKET = &HA
        ssfSTARTMENU = &HB
        ssfDESKTOPDIRECTORY = &H10
        ssfDRIVES = &H11
        ssfNETWORK = &H12
        ssfNETHOOD = &H13
        ssfFONTS = &H14
        ssfTEMPLATES = &H15
    End Enum
        
    
    Public Sub Main()
    Dim oShell As Shell
    Set oShell = New Shell
    
    
    'oShell.Explore ssfDRIVES  'this brings up Windows explorer on My computer
    oShell.Open ssfDRIVES   ' This Opens up a window on the desktop with My computer
    
    
    MsgBox "Press OK to end program", vbOKOnly, "End Program"
    
    Set oShell = Nothing
    
    End Sub
    end code

    [Edited by Stephenb on 11-21-2000 at 01:18 PM]
    Stephen Boston
    Onward!
    VB6 Pro SP4, VBScript
    A+ Certified Techncian.
    No matter where you go, there you are.

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