|
-
Nov 29th, 2001, 11:34 AM
#1
Thread Starter
Black Cat
BrowseForFolder - set root directory to Network Domain
I want the BrowseForFolder dialog to start at the domain. I can get it to start at "My Network Places" no problem, but under Windows 2000 you still have to drill thru Entire Network -> Microsoft Windows Network -> MyDomain. I can get the domain name with Environ$("USERDOMAIN"). Is there a way I can get the pidl of that, or set the dialog to start there so the list of computers is immediately presented?
Thanks.
VB Code:
Public Function BrowseForComputer(hwnd As Long) As String
Dim bi As BROWSEINFO
Dim retval As Long
Dim pidl As Long
'get the pidl of "My Network Places"
retval = SHGetSpecialFolderLocation(hwnd, CSIDL_NETWORK, pidl)
If retval <> 0 Then
Debug.Print "Couldn't get network pidl."
BrowseForComputer = ""
Exit Function
End If
With bi
.hwndOwner = hwnd
.pidlRoot = pidl
.pszDisplayName = String$(MAX_PATH, vbNullChar)
.lpszTitle = "Browse for Computer" & vbNullChar
.ulFlags = BIF_BROWSEFORCOMPUTER
End With
retval = SHBrowseForFolder(bi)
If retval <> 0 Then
BrowseForComputer = Replace(bi.pszDisplayName, vbNullChar, "")
Else
BrowseForComputer = ""
End If
Call CoTaskMemFree(pidl)
End Function
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Nov 29th, 2001, 03:03 PM
#2
.pidl = CSIDL_NETHOOD gets you a little closer.
I think it may be closer to what you want. There is no CSIDL_NODENAME or CSIDL_MYDOMAIN constant, which is what you would have to have to start with a domain server-centric view of a domain.
I don't know anything that will actually help. MSDNdoesn't have anything I can find either. Interesting question....
-
Nov 30th, 2001, 11:42 AM
#3
Thread Starter
Black Cat
No, the CSIDL_NETWORK constant works better. Thanks anyway.
I would think you could set it to an arbitrary folder...
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|