Thread View: comp.lang.basic.visual.database
2 messages
2 total messages
Started by Sam
Fri, 06 Mar 1998 00:00
List Box Control
Author: Sam
Date: Fri, 06 Mar 1998 00:00
Date: Fri, 06 Mar 1998 00:00
5 lines
999 bytes
999 bytes
Does anyone have a active x control list box that will see the networkneighborhood and Maybe Mycomputer. The list box with visual basic only sees the local drives and any drives that are mapped. please help if anyone has any suggestions.
Re: List Box Control
Author: Peter Walsh
Date: Mon, 09 Mar 1998 00:00
Date: Mon, 09 Mar 1998 00:00
85 lines
3393 bytes
3393 bytes
Sam <jasam@urs2.net> wrote in article <35003e1b.0@larry.urs2.net>...
> Does anyone have a active x control list box that will see the
> networkneighborhood and Maybe Mycomputer. The list box with visual basic
> only sees the local drives and any drives that are mapped. please help if
> anyone has any suggestions.
>
Try the following code:
' Stuff for selecting a folder in API
Public Type SHITEMID 'mkid
cb As Long
abID() As Byte
End Type
Public Type ITEMIDLIST 'idl
mkid As SHITEMID
End Type
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 Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" _
(ByVal pidl As Long, ByVal pszPath As String) As Long
Public Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" _
(lpBrowseInfo As BROWSEINFO) As Long
Public Const BIF_RETURNONLYFSDIRS = &H1
Function SelectFolder(oFrm As Form, Optional sRootPath As Variant, Optional
sTitle As Variant) As String
Dim i As Integer
Dim bi As BROWSEINFO
Dim IDL As ITEMIDLIST, IID As SHITEMID
Dim pidl As Long
Dim r As Long
Dim pos As Integer
Dim sPath As String
'Fill the BROWSEINFO structure with the needed data.
bi.hOwner = oFrm.hWnd
'Pointer to the item identifier list specifying the
'location of the "root" folder to browse from.
'If NULL, the desktop folder is used.
If Not IsMissing(sRootPath) Then
IID.cb = Len(sRootPath) + 4
ReDim IID.abID(Len(sRootPath) - 1)
For i = 1 To Len(sRootPath)
IID.abID(i - 1) = Asc(Mid(sRootPath, i, 1))
Next
End If
bi.pidlRoot = 0&
'message to be displayed in the Browse dialog.
'Note: the code here does not check to determine if
'in fact the system folder was selected; it is provided
'only as an example of a message.
If Not IsMissing(sTitle) Then _
bi.lpszTitle = sTitle
'the type of folder to return.
bi.ulFlags = BIF_RETURNONLYFSDIRS
'show the browse folder dialog
pidl& = SHBrowseForFolder(bi)
'the dialog has closed, so parse & display the user's
'returned folder selection contained in pidl&.
sPath$ = Space$(512)
r = SHGetPathFromIDList(ByVal pidl&, ByVal sPath$)
If r Then
pos = InStr(sPath$, Chr$(0))
SelectFolder = Left(sPath$, pos - 1)
Else: SelectFolder = ""
End If
End Function
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads