-
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
-
<?>
Shell "rundll32.exe shell32.dll,Control_RunDLL", vbNormalFocus
-
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
-
just open a new ie window and make it goto "My Computer"
-
adn the rest are Control Panel, Recycle Bin, Network Neighborhood(sp?)
-
<?>
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
-
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]